jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.14k stars 948 forks source link

pytest 8 deprecated nose support #3883

Closed maartenbreddels closed 2 months ago

maartenbreddels commented 7 months ago

With pytest 8 we now get the warning:

ERROR ipywidgets/tests/test_embed.py::TestEmbed::test_minimal_html_filename - pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
ipywidgets/tests/test_embed.py::TestEmbed::test_minimal_html_filename is using nose-specific method: `teardown(self)`
To remove this warning, rename it to `teardown_method(self)`
See docs: [https://docs.pytest.org/en/stable/deprecations.html#suppor](https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose)

We currently fail on warnings. We should probably modify our test and unpin pytest (pinning of < 8 originally done in #3866 )

I think this is a great project for a (new) contributor

frenzymadness commented 5 months ago

There seems to be more than the warning now. We are testing ipywidgets with pytest 8 and we're getting a lot of failures like:

____________________________ test_empty_send_state _____________________________

    def test_empty_send_state():
        w = SimpleWidget()
        w.send_state([])
>       assert w.comm.messages == []
E       AttributeError: 'DummyComm' object has no attribute 'messages'

and that seems to be caused by pytests ignoring setup/teardown functions in https://github.com/jupyter-widgets/ipywidgets/blob/b78de43e12ff26e4aa16e6e4c6844a7c82a8ee1c/python/ipywidgets/ipywidgets/widgets/tests/utils.py#L90-L94