-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
AttributeError: 'DoctestItem' object has no attribute 'fixturenames' #5070
Comments
Any pointers in how to address this? I think it should be a given that items ins |
i believe it will happen to practically all item types that have no direct fixture system integration (aka 3rd party plugins as well, its really tricky to touch |
Yeah as @RonnyPfannschmidt said, custom items which don't implement fixtures, while uncommon, are a definite possibility (besides Doctests, pytest-cpp also has custom items). Unfortunately I don't have any idea on how to improve this situation. Unless somebody has a suggestion, I think we should close this. :/ |
What about a mixin / base class to have an empty list there? |
From a "pure" design POV it would not be nice, because items are generic and might be customizable. Fixtures are a feature only available on But I lean towards the former, otherwise we now have this implicit contract that I know it sucks and it trips some people, but down the road we might make things worse for ourselves if we have to guarantee that all items have a |
I think a common use case is to look at fixtures in
pytest_collect_modifyitems
:But this crashes when doctests are involved:
This was fixed for
--fixtures-per-test
in #2789, but I think it would be better to just have an empty list there maybe?The text was updated successfully, but these errors were encountered: