-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better handling of conflicting --copies and --symlinks
Introduce priority of where the option is set to follow the order: cli, env var, file, hard coded. If both set at same level prefer copy over symlink. Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
- Loading branch information
1 parent
a5f4721
commit efffb7f
Showing
4 changed files
with
77 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Better handling of conflicting :conf:`copies` and :conf:`symlinks`. Introduce priority of where the option is set to | ||
follow the order: CLI, env var, file, hardcoded. If both set at same level prefers copy over symlink. - by | ||
user:`gaborbernat`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from textwrap import dedent | ||
|
||
from tests.unit.config.test_env_var import parse_cli | ||
from virtualenv.util.six import ensure_str | ||
|
||
|
||
def test_ini_can_be_overwritten_by_flag(tmp_path, monkeypatch): | ||
custom_ini = tmp_path / "conf.ini" | ||
custom_ini.write_text( | ||
dedent( | ||
""" | ||
[virtualenv] | ||
copies = True | ||
""" | ||
) | ||
) | ||
monkeypatch.setenv(ensure_str("VIRTUALENV_CONFIG_FILE"), str(custom_ini)) | ||
|
||
result = parse_cli(["venv", "--symlinks"]) | ||
|
||
symlinks = result.creator.symlinks | ||
assert symlinks is True |