-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
MAINT: Move pytesttester outside of np.testing, to avoid creating unnecessary import dependencies #11473
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
The motivation here was to try and make |
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.
numpy/_pytesttester.py
Outdated
@@ -23,6 +23,8 @@ | |||
In practice, tests run from the numpy repo are run in develop mode. That | |||
includes the standard ``python runtests.py`` invocation. | |||
|
|||
This module is imported by every numpy subpackage, so lies at the top level to | |||
simplify circular import issues. |
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.
Maybe add something like "This is also why numpy and pytest are not imported on top, but rather inside _show_numpy_info
and PytestTester.__call__
"
numpy/testing/__init__.py
Outdated
from ._private.nosetester import ( | ||
run_module_suite, NoseTester as Tester | ||
) | ||
from ._private.utils import * |
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.
Not that I mind, but was there a specific reason for the reordering?
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.
I think this was accidental
…ecessary import dependencies pytesttester is used by every single subpackage, so making it depend on np.testing just creates cyclic dependencies that can lead to circular imports Relates to numpy#11457
6654aca
to
11302b6
Compare
Comments updated |
LGTM, thanks @eric-wieser |
I note that the imports of |
@charris: I'd be very surprised if numpy doesn't already import those somewhere else anyway. At any rate, there's no risk of a circular dependency there |
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, the added comment is now very clear.
Merging, since tests passed before and only a comment was changed. |
pytesttester is used by every single subpackage, so making it depend on np.testing just creates cyclic dependencies that can lead to circular imports
Importantly, this breaks a cyclic dependency between
np.lib
andnp.core
Relates to #11457