-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Description
This task has been started in PR #5405, but ended without success, so I have decided to split it to multiple stages:
- Make
pytestcompatible with the current test suite- Add support of unitest-like fixtures (
setUpand other methods) on classes not derived fromunitest.UnitTest(fixed with 8b64294) - Add support of
image_comparisonandknownfailifdecorator (fixed with bbaf7dc) - Fix
raise KnownFailureTestproblems (PR Add Py.test testing framework support #6730)-
ImageComparisonTest.test -
test_axes.test_formatter_large_small -
test_backend_pgf.compare_figure -
test_animation.check_save_animation -
test_coding_standards.test_pep8_conformance_examples
-
-
test_basicleaks tests fromnumpyinto global scope withfrom pylab import *(fixed with 30caf00) - Solve strange failures on several tests
-
test_subplots.test_subplots_offsettext(PR Missingcleanupdecorator intest_subplots.test_exceptions#6741) -
test_axes.test_eventplot_problem_kwargs(PR Fixed warnings catching and counting withwarnings.catch_warnings#6761) -
test_pickle.test_complete(PR Fixed brokentest_pickle.test_completetest #6840)
-
- Ensure that pytest collects all the tests (6150/6150) (actually nose shows 6151 because it counts
lib/matplotlib/tests/test_delaunay.py::make_all_2d_testfuncsas a test)
- Add support of unitest-like fixtures (
- Migration to pytest
- Add new build under
allow_failureswith pytest- Appveyor
- Travis
- Use
pytest-covfor coverage reports
- Replace nose in all builds with pytest
- Add new build under
- Post-migration
- Rename
setUp->setup_methodand other methods topytestanalogs- Do not inherit tests from
unitest.UnitTestclass - Remove
setUp/tearDownworkaround
- Do not inherit tests from
- Rewrite
image_comparisondecorator (currently it slowdowns the collection phase due to baseline images copying) or usepytest-mplplugin (needs some improvements, see paragraph below) - Rewrite all assertations to pure
assert - Get away from
cleanupdecorator - Replace
knownfailifwithmark.xfail - Replace
raise nose.SkipTest(...)withxfail(...)call ormark.skipifdecorator
- Rename
- Enhancements
- Replace
setup_methodand etc methods with fixtures -
Rewritetest_delaunay.make_all_2d_testfuncs - Use
pytest-pep8plugin instead oftest_coding_standards -
Usepytest-mockplugin instead ofmockandunittest.mock
- Replace
Tests entry point (raised in #5405 (comment))
I think that running tests with simple py.test command is better than python tests.py, but there are unused tests which will run that way. Solutions:
- A. Get them away from pytest's sight with:
-
Remove unused tests (test_sankey,test_skew,test_ttconv, andtest_usetexfromlib/matplotlib/tests) - Rename
test_only.py(tosetup_test_only.pyprobably)
-
- B. Make filter for collection phase.
- Implement whitelist
- Implement blacklist
I have tried both ways and they work, so what to choose is up to you.
py.test --collect-filter=nonepy.test --collect-filter=blacklistpy.test --collect-filter=whitelist
Currently --collect-filter=whitelist is default (to follow same politics as nose does currently).
Image comparison decorator
Why do we have to rewrite image_comparison decorator? Because pytest-mpl plugin in the current state ("as is") is not usable for matplotlib:
- + supports
savefig_kwargs - + supports
tolerance - ‒ need to supply
baseline_dirin every decorator - ‒ does not support image format conversion
- ‒ need something to do with
freetype_version,remove_text, andstyle