-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Migration to Py.test testing framework #6731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
As someone who's a big fan of these, what's the rational? Unlike nose, it's part of the standard library and it doesn't seem like it's likely to be deprecated. |
Yeah, I guess my question is "will pytest not run unittest" tests? Like I understand dumping nose 'cause it's deprecated, but I don't get the issue with unittest unless it explicitly won't work with pytest |
They will work and they are working (pytest handles them with some internal loader hacking in |
We would work with @astrofrog to get the features we need in |
@tacaswell are you sure we want to do that. It's the opposite of what @mdboom suggested in #5405 |
@tacaswell - I'd be happy to chat about this at SciPy! |
Regarding the negatives for pytest-mpl:
Actually this is not quite correct - there is a default value which is a folder called
I don't think there's any reason we can't add all this, and I don't think it should be that difficult. I'd love to work with you all to make pytest-mpl suitable for matplotlib! (these are all features I would find useful for other projects I use pytest-mpl for) |
Another point: we need to get rid of the |
The |
It looks like we can. At least I have tried and it is good. PR #7468 is opened. |
In my own project using pytest, attempting to use |
Are you aware of https://github.com/matplotlib/pytest-mpl ? |
@jnothman This will be in the 2.1 release so unless you have installed from source you will not have it. pytest-mpl is probably a better option. |
Yes, I'm using pytest-mpl, but having trouble where fonts get in the way,
and for the same reasons would rather compare something other than PNG. But
I may have merely failed to get the freetype font defaulting working and
life may be better when I do.
…On 16 March 2017 at 15:12, Thomas A Caswell ***@***.***> wrote:
@jnothman <https://github.com/jnothman> This will be in the 2.1 release
so unless you have installed from source you will not have it.
pytest-mpl is probably a better option.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6731 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAEz6-3wUR9l2JwHAHnlY0aahHKgAykHks5rmLbDgaJpZM4JKrar>
.
|
@jnothman Have you seen the |
I think we can close this now. Is that the case? |
There are still items unchecked that need to be implemented or decided to ignore. |
Items I think we should ignore:
I'm -0 on using |
I've marked
as done. I agree with @phobson that Also checked
because there is no such file anymore. |
I decided to strikeout the "use pytest-mock" line (agreeing with @phobson above); unittest.mock works just fine in the rare cases where we use it and bringing in a new dependency seems overkill (unless someone has a good use case for it in the test suite, in which case please speak up :)). |
The "rewrite image_comparison (currently it slows down collection due to baseline image copying)" item seems not true anymore:
|
Technically there is one setup_method left in test_transforms.py, but in that specific case it doesn't seem worthwhile to remove it. |
This task has been started in PR #5405, but ended without success, so I have decided to split it to multiple stages:
pytest
compatible with the current test suitesetUp
and other methods) on classes not derived fromunitest.UnitTest
(fixed with 8b64294)image_comparison
andknownfailif
decorator (fixed with bbaf7dc)raise KnownFailureTest
problems (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_basic
leaks tests fromnumpy
into global scope withfrom pylab import *
(fixed with 30caf00)test_subplots.test_subplots_offsettext
(PR Missingcleanup
decorator 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_complete
test #6840)lib/matplotlib/tests/test_delaunay.py::make_all_2d_testfuncs
as a test)allow_failures
with pytestpytest-cov
for coverage reportssetUp
->setup_method
and other methods topytest
analogsunitest.UnitTest
classsetUp
/tearDown
workaroundimage_comparison
decorator (currently it slowdowns the collection phase due to baseline images copying) or usepytest-mpl
plugin (needs some improvements, see paragraph below)assert
cleanup
decoratorknownfailif
withmark.xfail
raise nose.SkipTest(...)
withxfail(...)
call ormark.skipif
decoratorsetup_method
and etc methods with fixturesRewritetest_delaunay.make_all_2d_testfuncs
pytest-pep8
plugin instead oftest_coding_standards
Usepytest-mock
plugin instead ofmock
andunittest.mock
Tests entry point (raised in #5405 (comment))
I think that running tests with simple
py.test
command 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_usetex
fromlib/matplotlib/tests
)test_only.py
(tosetup_test_only.py
probably)I have tried both ways and they work, so what to choose is up to you.
py.test --collect-filter=none
py.test --collect-filter=blacklist
py.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? Becausepytest-mpl
plugin in the current state ("as is") is not usable for matplotlib:savefig_kwargs
tolerance
baseline_dir
in every decoratorfreetype_version
,remove_text
, andstyle
The text was updated successfully, but these errors were encountered: