From 03b91332161b0eda53be3319c06bda6f921e2686 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Mon, 23 Dec 2024 11:14:45 +0000 Subject: [PATCH] Make seed option implicit and add --no-seed --- src/ansible_dev_environment/arg_parser.py | 5 +++-- src/ansible_dev_environment/subcommands/installer.py | 2 +- tests/conftest.py | 1 + tests/unit/test_installer.py | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ansible_dev_environment/arg_parser.py b/src/ansible_dev_environment/arg_parser.py index 195de23..a887ed5 100644 --- a/src/ansible_dev_environment/arg_parser.py +++ b/src/ansible_dev_environment/arg_parser.py @@ -197,8 +197,9 @@ def parse() -> argparse.Namespace: install.add_argument( # "-adt", "--seed", - action="store_true", - dest="adt", + action=argparse.BooleanOptionalAction, + default=True, + dest="seed", help="Install seed packages inside the virtual environment (ansible-dev-tools).", ) diff --git a/src/ansible_dev_environment/subcommands/installer.py b/src/ansible_dev_environment/subcommands/installer.py index b95d37c..322f3b5 100644 --- a/src/ansible_dev_environment/subcommands/installer.py +++ b/src/ansible_dev_environment/subcommands/installer.py @@ -56,7 +56,7 @@ def run(self) -> None: err = "Multiple optional dependencies are not supported at this time." self._output.critical(err) - if self._config.args.adt: + if self._config.args.seed: self._install_dev_tools() else: self._install_core() diff --git a/tests/conftest.py b/tests/conftest.py index fee8c1b..778522a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -195,6 +195,7 @@ def session_venv(session_dir: Path, monkey_session: pytest.MonkeyPatch) -> Confi [ "ade", "install", + "--no-seed", "-r", str(GALAXY_CACHE / REQS_FILE_NAME), "--venv", diff --git a/tests/unit/test_installer.py b/tests/unit/test_installer.py index 216d2e6..f775d8d 100644 --- a/tests/unit/test_installer.py +++ b/tests/unit/test_installer.py @@ -271,7 +271,7 @@ def test_no_adt_install( args = Namespace( venv=venv, verbose=0, - adt=False, + seed=False, system_site_packages=False, collection_specifier=None, requirement=None, @@ -302,7 +302,7 @@ def test_adt_install( args = Namespace( venv=venv, verbose=0, - adt=True, + seed=True, system_site_packages=False, collection_specifier=None, requirement=None,