Skip to content

Commit

Permalink
Fix compatibility with pytest 8
Browse files Browse the repository at this point in the history
setup/teardown nose methods are no longer supported by pytest 8.
https://docs.pytest.org/en/latest/deprecations.html#setup-teardown
  • Loading branch information
frenzymadness committed Apr 20, 2024
1 parent f476dd7 commit cdacafd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions IPython/core/tests/test_pylabtools.py
Expand Up @@ -165,7 +165,7 @@ def init_history(self):
def enable_gui(self, gui):
pass

def setup(self):
def setup_method(self):
import matplotlib
def act_mpl(backend):
matplotlib.rcParams['backend'] = backend
Expand All @@ -184,7 +184,7 @@ def act_mpl(backend):
self._save_cis = backend_inline.configure_inline_support
backend_inline.configure_inline_support = lambda *a, **kw: None

def teardown(self):
def teardown_method(self):
pt.activate_matplotlib = self._save_am
pt.import_pylab = self._save_ip
backend_inline.configure_inline_support = self._save_cis
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Expand Up @@ -94,7 +94,7 @@ qtconsole = [
]
terminal = []
test = [
"pytest<8",
"pytest",
"pytest-asyncio<0.22",
"testpath",
"pickleshare",
Expand Down

1 comment on commit cdacafd

@mgorny
Copy link
Contributor

@mgorny mgorny commented on cdacafd Apr 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still getting a ton of test failures. There's #14390 open for pytest 8.1-specific issues already, but I'm also getting lots of different problems with pytest 8.0, e.g.:

doctest_item = <IPDoctestItem IPython.core.completer>

    def _setup_fixtures(doctest_item: IPDoctestItem) -> FixtureRequest:
        """Used by IPDoctestTextfile and IPDoctestItem to setup fixture information."""
    
        def func() -> None:
            pass
    
        doctest_item.funcargs = {}  # type: ignore[attr-defined]
        fm = doctest_item.session._fixturemanager
>       doctest_item._fixtureinfo = fm.getfixtureinfo(  # type: ignore[attr-defined]
            node=doctest_item, func=func, cls=None, funcargs=False
        )
E       TypeError: FixtureManager.getfixtureinfo() got an unexpected keyword argument 'funcargs'

doctest_item = <IPDoctestItem IPython.core.completer>
fm         = <_pytest.fixtures.FixtureManager object at 0x00005557d1375c20>
func       = <function _setup_fixtures.<locals>.func at 0x00005557d4183a60>

IPython/testing/plugin/pytest_ipdoctest.py:704: TypeError

Please sign in to comment.