Make matplotlib.testing assume pytest by default, not nose. #13918
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, matplotlib.testing generates nose-based tests (through the
deprecated ImageComparisonTest class and nose.SkipTest), unless one is
actually running tests with pytest (so that matplotlib.testing.conftest
has been run).
This means that e.g. importing
matplotlib.tests.test_foo
will fail ifnose is not installed (because we'll try to import nose.tools).
Given that both support for nose in Matplotlib and nose itself are
deprecated, invert the logic to generate pytest-base tests unless
both matplotlib.testing.conftest has not been run by pytest, and
"nose" is already in sys.modules.
Also change the default value of the "obj_type" parameter from
"attribute" to cbook.warn_deprecated to the empty string (the previous
default was never used, and the empty string as default is practical
e.g. in the case in this PR).
PR Summary
PR Checklist