'Change syntax of -k option in pytest 7.1.0 is not working with pytest_addoption(parser)
Below is my code which was working perfectly fine till I upgraded pytest to version 7.1.0
pytest.main(self.pytest_args + ["-k", tc_cfg.name, "--aq-cfg", tc_cfg.aq_cfg])
and in conftest, I have below code:
def pytest_addoption(parser):
parser.addoption("--aq-cfg", required=False)
This was working fine for earlier pytest versions. With latest one(pytest 7.1.0) its failing with below error:
ERROR: usage: aqueduct [options] [file_or_dir] [file_or_dir] [...]
aqueduct: error: unrecognized arguments: --aq-cfg all_envs
inifile: /home/aquser/dev/aqueduct/src/cb/test/tools/aqueduct/pytest.ini
rootdir: /home/aquser/dev/aqueduct/src/cb/test/tools/aqueduct
This is occurring because latest change added for -k syntax: https://docs.pytest.org/en/stable/changelog.html#pytest-7-1-0-2022-03-13
But if I try to remove --aq-cfg, its failing at pytest_adoption(parsar) and not able to locate file without "--". Any help on this would be appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
