diff --git a/docs/changelog/1813.bugfix.rst b/docs/changelog/1813.bugfix.rst new file mode 100644 index 000000000..7a894bb43 --- /dev/null +++ b/docs/changelog/1813.bugfix.rst @@ -0,0 +1 @@ +Fix download is ``True`` by default - by :user:`gaborbernat`. diff --git a/src/virtualenv/seed/embed/base_embed.py b/src/virtualenv/seed/embed/base_embed.py index 1067a7b70..e98a72d1c 100644 --- a/src/virtualenv/seed/embed/base_embed.py +++ b/src/virtualenv/seed/embed/base_embed.py @@ -45,13 +45,6 @@ def package_version(self): @classmethod def add_parser_arguments(cls, parser, interpreter, app_data): group = parser.add_mutually_exclusive_group() - group.add_argument( - "--download", - dest="download", - action="store_true", - help="pass to enable download of the latest {} from PyPI".format("/".join(cls.packages)), - default=False, - ) group.add_argument( "--no-download", "--never-download", @@ -60,6 +53,13 @@ def add_parser_arguments(cls, parser, interpreter, app_data): help="pass to disable download of the latest {} from PyPI".format("/".join(cls.packages)), default=True, ) + group.add_argument( + "--download", + dest="download", + action="store_true", + help="pass to enable download of the latest {} from PyPI".format("/".join(cls.packages)), + default=False, + ) parser.add_argument( "--extra-search-dir", metavar="d", diff --git a/tests/unit/seed/test_base_embed.py b/tests/unit/seed/test_base_embed.py new file mode 100644 index 000000000..379211c6e --- /dev/null +++ b/tests/unit/seed/test_base_embed.py @@ -0,0 +1,11 @@ +import pytest + +from virtualenv.run import session_via_cli + + +@pytest.mark.parametrize( + "args, download", [([], False), (["--no-download"], False), (["--never-download"], False), (["--download"], True)] +) +def test_download_cli_flag(args, download, tmp_path): + session = session_via_cli(args + [str(tmp_path)]) + assert session.seeder.download is download