-
-
Notifications
You must be signed in to change notification settings - Fork 11k
TST, MAINT: Add __init__.py
files to tests directories.
#9524
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
Conversation
This is an alternative to #9523. Also checking that tests pass with this change. |
This allows pytest to run with duplicate test file names. Note that `python <path-to-test-file>` no longer works with this change, nor will a simple `pytest numpy`, because numpy is imported from the numpy repository. However, `python runtests.py` and `>>> numpy.test()` are still available.
d507cdd
to
62a12d2
Compare
@eric-wieser No, that is a relative path and can't be used with |
You can still import and run numpy.test(...), this only affects running a test file using EDIT: It only runs tests against installed numpy, so can be useful in test development. For testing new code, python runtests.py is still the way to go. |
Not sure if this fix will work with pytest without some help. Otherwise might be stuck with only using |
Yeah, I can make this work for pytest also, just need the
That should even work with relative imports. When we are all in for pytest, can maybe change it back. Note the |
Hmm, I think I will undo the last commit and just use |
dbcce72
to
62a12d2
Compare
OK, should be ready to go, I undid last commit. I will add a release note in a future PR once I've settled a few more things. |
FWIW when I want to run a subset of tests with pytest I usually do something like |
@njsmith The problem is that after adding the
|
Gotta happen eventually, so putting this in. |
This allows pytest to run with duplicate test file names. Note that
python <path-to-test-file>
no longer works with this change, nor willa simple
pytest numpy
, because numpy is imported from the numpyrepository. However,
python runtests.py
and>>> numpy.test()
arestill available.