-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
topic: configrelated to config handling, argument parsing and config filerelated to config handling, argument parsing and config filetype: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity
Description
Hi!
I recently started working with more advanced conftest.py
features and I stumbled upon something that looks like an incorrect behavior to me:
❗ Here I share a minimal example to reproduce my issue: https://github.com/mtsokol/pytest-conftest-bug
In a nutshell:
- I have a pytest option added to a parser
--my-option
- I have a custom logic in
pytest_collection_modifyitems
where I traverse collected tests and decide which one should be skipped. - When I pass an option value that is an arbitrary string, e.g.
pytest my_module --my-option foobar
the test that is collected hasnodeid
of'my_module/test_sth.py::test_foo'
- But when the option that I pass is an absolute path
pytest my_module --my-option /Users/user/foobar
then the test hasnodeid
of'test_sth.py::test_foo'
This breaks my test suite as collected tests can't be properly matched/filtered, because a path for one of the options in pytest
command changed from relative to absolute.
Would you consider it a bug? Or is it an expected behavior?
I'm using pytest 7.4.3
and macos 12.7.1.
Thank you for any guidance!
Metadata
Metadata
Assignees
Labels
topic: configrelated to config handling, argument parsing and config filerelated to config handling, argument parsing and config filetype: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity