Skip to content

Commit

Permalink
Merge pull request #1244 from pypa/hotfix/handle_drive_parsing_error
Browse files Browse the repository at this point in the history
Fix ensure_project bug on windows when missing pipfile
  • Loading branch information
kennethreitz committed Jan 11, 2018
2 parents f5b4824 + 30e4a97 commit d8dc25b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pipenv/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def normalize_drive(path):
See: <https://github.com/pypa/pipenv/issues/1218>
"""
if os.name != 'nt':
if os.name != 'nt' or not isinstance(path, six.string_types):
return path
drive, tail = os.path.splitdrive(path)
# Only match (lower cased) local drives (e.g. 'c:'), not UNC mounts.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_pipenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest

from pipenv.cli import activate_virtualenv
from pipenv.utils import temp_environ, get_windows_path, mkdir_p
from pipenv.utils import temp_environ, get_windows_path, mkdir_p, normalize_drive
from pipenv.vendor import toml
from pipenv.vendor import delegator
from pipenv.project import Project
Expand Down Expand Up @@ -96,7 +96,7 @@ class TestPipenv:
@pytest.mark.cli
def test_pipenv_where(self):
with PipenvInstance() as p:
assert p.path in p.pipenv('--where').out
assert normalize_drive(p.path) in p.pipenv('--where').out

@pytest.mark.cli
def test_pipenv_venv(self):
Expand Down Expand Up @@ -708,7 +708,7 @@ def test_venv_in_project(self):
c = p.pipenv('install requests')
assert c.return_code == 0

assert p.path in p.pipenv('--venv').out
assert normalize_drive(p.path) in p.pipenv('--venv').out

@pytest.mark.dotvenv
@pytest.mark.install
Expand Down Expand Up @@ -738,7 +738,7 @@ def test_shell_nested_venv_in_project(self):
# Compare pew's virtualenv path to what we expect
venv_path = get_windows_path(project.project_directory, '.venv')
# os.path.normpath will normalize slashes
assert venv_path == os.path.normpath(c.out.strip())
assert venv_path == normalize_drive(os.path.normpath(c.out.strip()))
# Have pew run 'pip freeze' in the virtualenv
# This is functionally the same as spawning a subshell
# If we can do this we can theoretically amke a subshell
Expand Down

0 comments on commit d8dc25b

Please sign in to comment.