-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
TST,MAINT: pytest 8 phases out some nose "plugin" backwards compatibility #22486
Copy link
Copy link
Closed
Closed
Copy link
Description
See also https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose
The main thing affecting us is probably the setup and teardown methods being renamed, which seems like a simple enough task.
unfortunately that log is gigantic, just one failure as an example (setup being used in numpy.core.tests.test_arrayprint.TestPrintOptions ):
Details
2022-10-27T11:40:44.3525868Z ________________ ERROR at setup of TestPrintOptions.test_basic _________________
2022-10-27T11:40:44.3527487Z
2022-10-27T11:40:44.3531550Z cls = <class '_pytest.runner.CallInfo'>
2022-10-27T11:40:44.3544920Z func = <function call_runtest_hook.<locals>.<lambda> at 0x7f05b3bcf670>
2022-10-27T11:40:44.3547343Z when = 'setup'
2022-10-27T11:40:44.3549287Z reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
2022-10-27T11:40:44.3550421Z
2022-10-27T11:40:44.3555820Z @classmethod
2022-10-27T11:40:44.3557326Z def from_call(
2022-10-27T11:40:44.3558452Z cls,
2022-10-27T11:40:44.3559615Z func: "Callable[[], TResult]",
2022-10-27T11:40:44.3562928Z when: "Literal['collect', 'setup', 'call', 'teardown']",
2022-10-27T11:40:44.3565598Z reraise: Optional[
2022-10-27T11:40:44.3568089Z Union[Type[BaseException], Tuple[Type[BaseException], ...]]
2022-10-27T11:40:44.3569619Z ] = None,
2022-10-27T11:40:44.3570778Z ) -> "CallInfo[TResult]":
2022-10-27T11:40:44.3571564Z """Call func, wrapping the result in a CallInfo.
2022-10-27T11:40:44.3572230Z
2022-10-27T11:40:44.3572860Z :param func:
2022-10-27T11:40:44.3573567Z The function to call. Called without arguments.
2022-10-27T11:40:44.3574285Z :param when:
2022-10-27T11:40:44.3575276Z The phase in which the function is called.
2022-10-27T11:40:44.3575975Z :param reraise:
2022-10-27T11:40:44.3576812Z Exception or exceptions that shall propagate if raised by the
2022-10-27T11:40:44.3578385Z function, instead of being wrapped in the CallInfo.
2022-10-27T11:40:44.3582708Z """
2022-10-27T11:40:44.3583411Z excinfo = None
2022-10-27T11:40:44.3584024Z start = timing.time()
2022-10-27T11:40:44.3584662Z precise_start = timing.perf_counter()
2022-10-27T11:40:44.3585242Z try:
2022-10-27T11:40:44.3585840Z > result: Optional[TResult] = func()
2022-10-27T11:40:44.3586273Z
2022-10-27T11:40:44.3587180Z cls = <class '_pytest.runner.CallInfo'>
2022-10-27T11:40:44.3587863Z duration = 0.0006314149999866459
2022-10-27T11:40:44.3589374Z excinfo = <ExceptionInfo PytestRemovedIn8Warning('Support for nose tests is deprecated and will be removed in a future release.\...od(self)`\nSee docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose') tblen=18>
2022-10-27T11:40:44.3590596Z func = <function call_runtest_hook.<locals>.<lambda> at 0x7f05b3bcf670>
2022-10-27T11:40:44.3591320Z precise_start = 490.698132145
2022-10-27T11:40:44.3591928Z precise_stop = 490.69876356
2022-10-27T11:40:44.3592942Z reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
2022-10-27T11:40:44.3593604Z result = None
2022-10-27T11:40:44.3594134Z start = 1666869108.8794293
2022-10-27T11:40:44.3594700Z stop = 1666869108.8800616
2022-10-27T11:40:44.3595586Z when = 'setup'
2022-10-27T11:40:44.3596028Z
2022-10-27T11:40:44.3597310Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/runner.py:339:
2022-10-27T11:40:44.3598090Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-10-27T11:40:44.3599097Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/runner.py:260: in <lambda>
2022-10-27T11:40:44.3599898Z lambda: ihook(item=item, **kwds), when=when, reraise=reraise
2022-10-27T11:40:44.3600766Z ihook = <_HookCaller 'pytest_runtest_setup'>
2022-10-27T11:40:44.3601398Z item = <Function test_basic>
2022-10-27T11:40:44.3601967Z kwds = {}
2022-10-27T11:40:44.3602881Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
2022-10-27T11:40:44.3603708Z return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
2022-10-27T11:40:44.3604522Z argname = 'item'
2022-10-27T11:40:44.3605073Z args = ()
2022-10-27T11:40:44.3605587Z firstresult = False
2022-10-27T11:40:44.3607411Z kwargs = {'item': <Function test_basic>}
2022-10-27T11:40:44.3608418Z self = <_HookCaller 'pytest_runtest_setup'>
2022-10-27T11:40:44.3617973Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
2022-10-27T11:40:44.3619097Z return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2022-10-27T11:40:44.3619798Z firstresult = False
2022-10-27T11:40:44.3620618Z hook_name = 'pytest_runtest_setup'
2022-10-27T11:40:44.3621516Z kwargs = {'item': <Function test_basic>}
2022-10-27T11:40:44.3623038Z methods = [<HookImpl plugin_name='nose', plugin=<module '_pytest.nose' from '/usr/share/miniconda/envs/numpy-dev/lib/python3.9/s...=None>>, <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f05bd203c10>>, ...]
2022-10-27T11:40:44.3624261Z self = <_pytest.config.PytestPluginManager object at 0x7f05be52e550>
2022-10-27T11:40:44.3625453Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/runner.py:155: in pytest_runtest_setup
2022-10-27T11:40:44.3626233Z item.session._setupstate.setup(item)
2022-10-27T11:40:44.3626834Z item = <Function test_basic>
2022-10-27T11:40:44.3627769Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/runner.py:495: in setup
2022-10-27T11:40:44.3628644Z raise exc
2022-10-27T11:40:44.3629198Z col = <Function test_basic>
2022-10-27T11:40:44.3629859Z finalizers = [<bound method Node.teardown of <Module test_arrayprint.py>>]
2022-10-27T11:40:44.3630542Z item = <Function test_basic>
2022-10-27T11:40:44.3631419Z needed_collectors = [<Session s exitstatus=<ExitCode.OK: 0> testsfailed=0 testscollected=22942>, <Package tests>, <Module test_arrayprint.py>, <Class TestPrintOptions>, <Function test_basic>]
2022-10-27T11:40:44.3632372Z self = <_pytest.runner.SetupState object at 0x7f05bd454eb0>
2022-10-27T11:40:44.3633561Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/runner.py:492: in setup
2022-10-27T11:40:44.3634314Z col.setup()
2022-10-27T11:40:44.3634844Z col = <Function test_basic>
2022-10-27T11:40:44.3635504Z finalizers = [<bound method Node.teardown of <Module test_arrayprint.py>>]
2022-10-27T11:40:44.3636169Z item = <Function test_basic>
2022-10-27T11:40:44.3637040Z needed_collectors = [<Session s exitstatus=<ExitCode.OK: 0> testsfailed=0 testscollected=22942>, <Package tests>, <Module test_arrayprint.py>, <Class TestPrintOptions>, <Function test_basic>]
2022-10-27T11:40:44.3653811Z self = <_pytest.runner.SetupState object at 0x7f05bd454eb0>
2022-10-27T11:40:44.3654928Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/python.py:1792: in setup
2022-10-27T11:40:44.3655548Z self._request._fillfixtures()
2022-10-27T11:40:44.3656008Z self = <Function test_basic>
2022-10-27T11:40:44.3656849Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:549: in _fillfixtures
2022-10-27T11:40:44.3657522Z item.funcargs[argname] = self.getfixturevalue(argname)
2022-10-27T11:40:44.3658468Z argname = '_xunit_setup_method_fixture_TestPrintOptions'
2022-10-27T11:40:44.3659577Z fixturenames = ['doctest_namespace', 'add_np', 'check_fpu_mode', 'env_setup', '_xunit_setup_method_fixture_TestPrintOptions', 'request', ...]
2022-10-27T11:40:44.3660337Z item = <Function test_basic>
2022-10-27T11:40:44.3660863Z self = <FixtureRequest for <Function test_basic>>
2022-10-27T11:40:44.3661790Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:568: in getfixturevalue
2022-10-27T11:40:44.3662549Z fixturedef = self._get_active_fixturedef(argname)
2022-10-27T11:40:44.3663340Z argname = '_xunit_setup_method_fixture_TestPrintOptions'
2022-10-27T11:40:44.3663961Z self = <FixtureRequest for <Function test_basic>>
2022-10-27T11:40:44.3665118Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:590: in _get_active_fixturedef
2022-10-27T11:40:44.3665832Z self._compute_fixture_value(fixturedef)
2022-10-27T11:40:44.3666617Z argname = '_xunit_setup_method_fixture_TestPrintOptions'
2022-10-27T11:40:44.3678328Z fixturedef = <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_arrayprint.py::TestPrintOptions'>
2022-10-27T11:40:44.3679355Z self = <FixtureRequest for <Function test_basic>>
2022-10-27T11:40:44.3680332Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:676: in _compute_fixture_value
2022-10-27T11:40:44.3681043Z fixturedef.execute(request=subrequest)
2022-10-27T11:40:44.3681828Z argname = '_xunit_setup_method_fixture_TestPrintOptions'
2022-10-27T11:40:44.3682371Z callspec = None
2022-10-27T11:40:44.3683568Z fixturedef = <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_arrayprint.py::TestPrintOptions'>
2022-10-27T11:40:44.3686922Z fixtures_not_supported = False
2022-10-27T11:40:44.3687584Z funcitem = <Function test_basic>
2022-10-27T11:40:44.3688057Z has_params = False
2022-10-27T11:40:44.3688506Z param = <NotSetType.token: 0>
2022-10-27T11:40:44.3689283Z param_index = 0
2022-10-27T11:40:44.3690384Z scope = <Scope.Function: 'function'>
2022-10-27T11:40:44.3691215Z self = <FixtureRequest for <Function test_basic>>
2022-10-27T11:40:44.3692071Z subrequest = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3693057Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:1074: in execute
2022-10-27T11:40:44.3693754Z result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
2022-10-27T11:40:44.3694428Z argname = 'request'
2022-10-27T11:40:44.3695692Z fixturedef = PseudoFixtureDef(cached_result=(<SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>, [0], None), _scope=<Scope.Function: 'function'>)
2022-10-27T11:40:44.3696631Z ihook = <_pytest.config.compat.PathAwareHookProxy object at 0x7f05bdda9d90>
2022-10-27T11:40:44.3697187Z my_cache_key = 0
2022-10-27T11:40:44.3698031Z request = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3699401Z self = <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_arrayprint.py::TestPrintOptions'>
2022-10-27T11:40:44.3700676Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/pluggy/_hooks.py:265: in __call__
2022-10-27T11:40:44.3701391Z return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
2022-10-27T11:40:44.3702062Z argname = 'request'
2022-10-27T11:40:44.3702654Z args = ()
2022-10-27T11:40:44.3703081Z firstresult = True
2022-10-27T11:40:44.3704401Z kwargs = {'fixturedef': <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/teste...::TestPrintOptions'>, 'request': <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>}
2022-10-27T11:40:44.3705677Z self = <_HookCaller 'pytest_fixture_setup'>
2022-10-27T11:40:44.3707981Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/pluggy/_manager.py:80: in _hookexec
2022-10-27T11:40:44.3709253Z return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
2022-10-27T11:40:44.3709775Z firstresult = True
2022-10-27T11:40:44.3710575Z hook_name = 'pytest_fixture_setup'
2022-10-27T11:40:44.3712229Z kwargs = {'fixturedef': <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/teste...::TestPrintOptions'>, 'request': <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>}
2022-10-27T11:40:44.3713945Z methods = [<HookImpl plugin_name='fixtures', plugin=<module '_pytest.fixtures' from '/usr/share/miniconda/envs/numpy-dev/lib/pyt...dule '_pytest.setuponly' from '/usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/setuponly.py'>>]
2022-10-27T11:40:44.3715117Z self = <_pytest.config.PytestPluginManager object at 0x7f05be52e550>
2022-10-27T11:40:44.3716135Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:1128: in pytest_fixture_setup
2022-10-27T11:40:44.3716887Z result = call_fixture_func(fixturefunc, request, kwargs)
2022-10-27T11:40:44.3717399Z arg_cache_key = [0]
2022-10-27T11:40:44.3718025Z argname = 'request'
2022-10-27T11:40:44.3718468Z exc = None
2022-10-27T11:40:44.3719842Z exc_info = (<class 'pytest.PytestRemovedIn8Warning'>, PytestRemovedIn8Warning('Support for nose tests is deprecated and will be r...docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose'), <traceback object at 0x7f05b3efa480>)
2022-10-27T11:40:44.3721609Z fixdef = PseudoFixtureDef(cached_result=(<SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>, [0], None), _scope=<Scope.Function: 'function'>)
2022-10-27T11:40:44.3723200Z fixturedef = <FixtureDef argname='_xunit_setup_method_fixture_TestPrintOptions' scope='function' baseid='build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_arrayprint.py::TestPrintOptions'>
2022-10-27T11:40:44.3724329Z fixturefunc = <bound method Class._inject_setup_method_fixture.<locals>.xunit_setup_method_fixture of <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>>
2022-10-27T11:40:44.3725476Z kwargs = {'request': <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>}
2022-10-27T11:40:44.3726065Z my_cache_key = 0
2022-10-27T11:40:44.3727085Z request = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3728217Z result = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3729992Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/fixtures.py:900: in call_fixture_func
2022-10-27T11:40:44.3730767Z fixture_result = next(generator)
2022-10-27T11:40:44.3731564Z fixturefunc = <bound method Class._inject_setup_method_fixture.<locals>.xunit_setup_method_fixture of <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>>
2022-10-27T11:40:44.3732578Z generator = <generator object Class._inject_setup_method_fixture.<locals>.xunit_setup_method_fixture at 0x7f05b65409e0>
2022-10-27T11:40:44.3733704Z kwargs = {'request': <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>}
2022-10-27T11:40:44.3734746Z request = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3735458Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2022-10-27T11:40:44.3735787Z
2022-10-27T11:40:44.3736327Z self = <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>
2022-10-27T11:40:44.3737279Z request = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3737742Z
2022-10-27T11:40:44.3741956Z @fixtures.fixture(
2022-10-27T11:40:44.3742469Z autouse=True,
2022-10-27T11:40:44.3742891Z scope="function",
2022-10-27T11:40:44.3743368Z # Use a unique name to speed up lookup.
2022-10-27T11:40:44.3744109Z name=f"_xunit_setup_method_fixture_{self.obj.__qualname__}",
2022-10-27T11:40:44.3744595Z )
2022-10-27T11:40:44.3745390Z def xunit_setup_method_fixture(self, request) -> Generator[None, None, None]:
2022-10-27T11:40:44.3746000Z method = request.function
2022-10-27T11:40:44.3746484Z if setup_method is not None:
2022-10-27T11:40:44.3746958Z func = getattr(self, setup_name)
2022-10-27T11:40:44.3747489Z _call_with_optional_argument(func, method)
2022-10-27T11:40:44.3747993Z if emit_nose_setup_warning:
2022-10-27T11:40:44.3748457Z > warnings.warn(
2022-10-27T11:40:44.3748951Z NOSE_SUPPORT_METHOD.format(
2022-10-27T11:40:44.3749468Z nodeid=request.node.nodeid, method="setup"
2022-10-27T11:40:44.3749942Z ),
2022-10-27T11:40:44.3750343Z stacklevel=2,
2022-10-27T11:40:44.3750752Z )
2022-10-27T11:40:44.3751330Z E pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
2022-10-27T11:40:44.3752596Z E build/testenv/lib/python3.9/site-packages/numpy/core/tests/test_arrayprint.py::TestPrintOptions::test_basic is using nose-specific method: `setup(self)`
2022-10-27T11:40:44.3753679Z E To remove this warning, rename it to `setup_method(self)`
2022-10-27T11:40:44.3754552Z E See docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose
2022-10-27T11:40:44.3754990Z
2022-10-27T11:40:44.3755371Z emit_nose_setup_warning = True
2022-10-27T11:40:44.3755831Z emit_nose_teardown_warning = True
2022-10-27T11:40:44.3756460Z func = <bound method TestPrintOptions.setup of <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>>
2022-10-27T11:40:44.3757292Z method = <bound method TestPrintOptions.test_basic of <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>>
2022-10-27T11:40:44.3758472Z request = <SubRequest '_xunit_setup_method_fixture_TestPrintOptions' for <Function test_basic>>
2022-10-27T11:40:44.3759225Z self = <numpy.core.tests.test_arrayprint.TestPrintOptions object at 0x7f05bd0bc220>
2022-10-27T11:40:44.3759911Z setup_method = <function TestPrintOptions.setup at 0x7f05bd0aa940>
2022-10-27T11:40:44.3760602Z setup_name = 'setup'
2022-10-27T11:40:44.3761190Z teardown_method = <function TestPrintOptions.teardown at 0x7f05bd0aab80>
2022-10-27T11:40:44.3761924Z teardown_name = 'teardown'
2022-10-27T11:40:44.3762221Z
2022-10-27T11:40:44.3763056Z /usr/share/miniconda/envs/numpy-dev/lib/python3.9/site-packages/_pytest/python.py:909: PytestRemovedIn8Warning
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels