Skip to content

Commit

Permalink
Revert "also disallow altsep beside pathsep inside paths"
Browse files Browse the repository at this point in the history
This reverts commit 524d95e.
  • Loading branch information
vphilippon committed Feb 12, 2020
1 parent 5fcbab2 commit 364f8be
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/virtualenv/create/creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,11 @@ def non_write_able(dest, value):
encoding, "".join(refused.keys()), raw_value
)
)
for char in (i for i in (os.pathsep, os.altsep) if i is not None):
if char in raw_value:
raise ArgumentTypeError(
"destination {!r} must not contain the path separator ({}) as this would break "
"the activation scripts".format(raw_value, char)
)
if os.pathsep in raw_value:
raise ArgumentTypeError(
"destination {!r} must not contain the path separator ({}) as this would break "
"the activation scripts".format(raw_value, os.pathsep)
)

value = Path(raw_value)
if value.exists() and value.is_file():
Expand Down
7 changes: 3 additions & 4 deletions tests/unit/create/test_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
CURRENT = PythonInfo.current_system()


@pytest.mark.parametrize("sep", [i for i in (os.pathsep, os.altsep) if i is not None])
def test_os_path_sep_not_allowed(tmp_path, capsys, sep):
target = "{}{}".format(str(tmp_path / "a"), "{}b".format(sep))
def test_os_path_sep_not_allowed(tmp_path, capsys):
target = str(tmp_path / "a{}b".format(os.pathsep))
err = _non_success_exit_code(capsys, target)
msg = (
"destination {!r} must not contain the path separator ({}) as this"
" would break the activation scripts".format(target, sep)
" would break the activation scripts".format(target, os.pathsep)
)
assert msg in err, err

Expand Down

0 comments on commit 364f8be

Please sign in to comment.