8000 MAINT: Move pytesttester outside of np.testing, to avoid creating unnecessary import dependencies by eric-wieser · Pull Request #11473 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MAINT: Move pytesttester outside of np.testing, to avoid creating unn…
…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 #11457
  • Loading branch information
eric-wieser committed Jul 2, 2018
commit 11302b66fec3e9f64e0eb77075344acec65d2c0f
2 changes: 1 addition & 1 deletion numpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def pkgload(*packages, **options):
from .testing import Tester

# Pytest testing
from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
boiler plate for doing that is to put the following in the module
``__init__.py`` file::

from numpy.testing import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__).test
del PytestTester

Expand All @@ -23,6 +23,9 @@
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. For the same reason, it contains no numpy
imports at module scope, instead importing numpy within function calls.
"""
from __future__ import division, absolute_import, print_function

Expand Down
2 changes: 1 addition & 1 deletion numpy/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def _ufunc_reduce(func):
del sys
del _ufunc_reduce

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/distutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Normally numpy is installed if the above import works, but an interrupted
# in-place build could also have left a __config__.py. In that case the
# next import may still fail, so keep it inside the try block.
from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
except ImportError:
Expand Down
2 changes: 1 addition & 1 deletion numpy/f2py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ def compile(source,
f.close()
return status

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/fft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
from .fftpack import *
from .helper import *

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@
__all__ += nanfunctions.__all__
__all__ += histograms.__all__

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/linalg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@

from .linalg import *

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/ma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
__all__ += core.__all__
__all__ += extras.__all__

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/matrixlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

__all__ = defmatrix.__all__

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/polynomial/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
from .hermite_e import HermiteE
from .laguerre import Laguerre

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/random/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ def __RandomState_ctor():
"""
return RandomState(seed=0)

from numpy.testing._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
2 changes: 1 addition & 1 deletion numpy/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

__all__ = _private.utils.__all__ + ['TestCase', 'run_module_suite']

from ._private.pytesttester import PytestTester
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
del PytestTester
0