You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_testfuncs as a test)
Migration to pytest
Add new build under allow_failures with pytest
Appveyor
Travis
Use pytest-cov for coverage reports
Replace nose in all builds with pytest
Post-migration
Rename setUp -> setup_method and other methods to pytest analogs
Do not inherit tests from unitest.UnitTest class
Remove setUp/tearDown workaround
Rewrite image_comparison decorator (currently it slowdowns the collection phase due to baseline images copying) or use pytest-mpl plugin (needs some improvements, see paragraph below)
Rewrite all assertations to pure assert
Get away from cleanup decorator
Replace knownfailif with mark.xfail
Replace raise nose.SkipTest(...) with xfail(...) call or mark.skipif decorator
Enhancements
Replace setup_method and etc methods with fixtures
Rewrite test_delaunay.make_all_2d_testfuncs
Use pytest-pep8 plugin instead of test_coding_standards
Use pytest-mock plugin instead of mock and unittest.mock
This task has been started in PR #5405, but ended without success, so I have decided to split it to multiple stages:
pytestcompatible with the current test suitesetUpand other methods) on classes not derived fromunitest.UnitTest(fixed with 8b64294)image_comparisonandknownfailifdecorator (fixed with bbaf7dc)raise KnownFailureTestproblems (PR Add Py.test testing framework support #6730)ImageComparisonTest.testtest_axes.test_formatter_large_smalltest_backend_pgf.compare_figuretest_animation.check_save_animationtest_coding_standards.test_pep8_conformance_examplestest_basicleaks tests fromnumpyinto global scope withfrom pylab import *(fixed with 30caf00)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)lib/matplotlib/tests/test_delaunay.py::make_all_2d_testfuncsas a test)allow_failureswith pytestpytest-covfor coverage reportssetUp->setup_methodand other methods topytestanalogsunitest.UnitTestclasssetUp/tearDownworkaroundimage_comparisondecorator (currently it slowdowns the collection phase due to baseline images copying) or usepytest-mplplugin (needs some improvements, see paragraph below)assertcleanupdecoratorknownfailifwithmark.xfailraise nose.SkipTest(...)withxfail(...)call ormark.skipifdecoratorsetup_methodand etc methods with fixturesRewritetest_delaunay.make_all_2d_testfuncspytest-pep8plugin instead oftest_coding_standardsUsepytest-mockplugin instead ofmockandunittest.mockTests entry point (raised in #5405 (comment))
I think that running tests with simple
py.testcommand is better thanpython tests.py, but there are unused tests which will run that way. Solutions:Remove unused tests (test_sankey,test_skew,test_ttconv, andtest_usetexfromlib/matplotlib/tests)test_only.py(tosetup_test_only.pyprobably)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=whitelistCurrently
--collect-filter=whitelistis default (to follow same politics as nose does currently).Image comparison decorator
Why do we have to rewrite
image_comparisondecorator? Becausepytest-mplplugin in the current state ("as is") is not usable for matplotlib:savefig_kwargstolerancebaseline_dirin every decoratorfreetype_version,remove_text, andstyle