-
-
Notifications
You must be signed in to change notification settings - Fork 26k
CLN avoid nested conftests #27954
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
CLN avoid nested conftests #27954
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to do a PR!
I didn't think of it at the time, but could you try on your machine to only remove the root conftest.py
and see whether it gets rid of the original issue on your machine? If so this may actually be the cleanest fix.
If only removing the root conftest.py
does not fix it, and as mentioned in #27806 (comment), I would keep sklearn/conftest.py
and move the content of sklearn/utils/tests/conftest.py
to it.
Additional comments:
- don't move the content to
conftest.py
.sklearn/conftest.py
is used on purpose so that the conftest.py is inside the distributed package (e.g. on PyPI) - keep
sklearn/externals/conftest.py
this is less likely to cause issue since this gets ignored - on top of this, I am pretty sure you can remove the root
conftest.py
these days, this is more of an historical thing
This doesn't seem to work.
You're right keeping this file doesn't cause issue.
@lesteve The strange thing is that, if I keep |
Hmmm OK so you are saying So contrary to what I thought, it seems like moving as much content to In an ideal world, someone would put together a simple reproducer for pytest-dev/pytest#9765. To be fair, it seems like it is not a single issue, since some people can reproduce on Windows, some people can reproduce on Linux. In our case, it seems Windows-specific. |
@lesteve Thanks for your response! Yet I think the current PR is okay for me. I in fact never really runs the whole test suite, but only run single module or file, so at least this PR solves my problem. In the corner cases I will use python -m pytest. These said, should me close or keep this PR? |
I am fine with this if this makes your like a bit easier:
|
Reference Issues/PRs
Fixes #27806.
What does this implement/fix? Explain your changes.
The purpose is to avoid nested conftests which seems to cause problem on some specific platforms with
pytest>7.0.1
. See #27806 for discussion.This PR combines all
conftest.py
undersklearn/
into a single one under the root directory (the originally emptyconftest.py
). Did not take care of the one underdoc/
because I'm not sure what to do with it.On my local machine,
pytest
,pytest sklearn
,pytest sklearn/utils/tests
, etc. raise errors with the main branch but work fine with this PR. I've checked that the number of collected tests is the same as before.@lesteve Would you please take a look?