ansible/pytest-ansible

ERROR: Missing required parameter --ansible-host-pattern/--host-pattern

ssbarnea opened this issue · 3 comments

When this plugin is installed, even if the project does not use it, we will see this error only standard error stream:

ERROR: Missing required parameter --ansible-host-pattern/--host-pattern

This happens even if the user does only run pytest --collect-only and causes confusions.

@ssbarnea can you describe the expected behaviour? Is host-pattern completely optional or just in some situations like when providing --collect-only ? Or perhaps a sensible default value such be applied, such as all ?

Presence of a pytest plugin should not make anything mandatory. If we have some options that are required, they should be required only when an ansible specific test is detected.

Think about people installing a plugin globally. That plugin should not break they use of pytest on other projects that have nothing to do with ansible.

This bug can be reproduced with ansible-lint repository which has a genuine fixture that happens to have a name starting with ansible_. Current implementation is flawed as assumes all fixtures starting with this are a sign that this plugin needs to be activated.