Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable unit test support by default #117

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/pytest_ansible/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,11 @@ def pytest_addoption(parser):
default=ansible.constants.DEFAULT_BECOME_ASK_PASS,
help="ask for privilege escalation password (default: %(default)s)",
)

group.addoption(
"--ansible-unit",
action="store_true",
default=False,
help="Enable support for ansible collection unit tests, inject paths and build the collection tree if needed.",
)
group.addoption(
"--ansible-unit-inject-only",
action="store_true",
default=False,
help="Enable support for ansible collection unit tests, only inject exisiting ANSIBLE_COLLECTIONS_PATHS.",
help="Enable support for ansible collection unit tests by only injecting exisiting ANSIBLE_COLLECTIONS_PATHS.",
)
# Add github marker to --help
parser.addini("ansible", "Ansible integration", "args")
Expand All @@ -177,7 +170,7 @@ def pytest_configure(config):

if config.option.ansible_unit_inject_only:
inject_only()
elif config.option.ansible_unit:
else:
start_path = config.invocation_params.dir
inject(start_path)

Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,4 @@ def test_inject_only(
def test_for_params():
"""Test for params."""
proc = subprocess.run("pytest --help", shell=True, capture_output=True, check=False)
assert "--ansible-unit" in proc.stdout.decode()
assert "--ansible-unit-inject-only" in proc.stdout.decode()