Thanks to visit codestin.com
Credit goes to github.com

Skip to content

updates error message to run pytest instead of tests.py standalone #11808

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

Merged
merged 2 commits into from
Aug 5, 2018

Conversation

eseiver
Copy link
Contributor

@eseiver eseiver commented Aug 2, 2018

PR Summary

updates the error message in NoopTestCommand to recommend using pytest instead of tests.py

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@@ -121,7 +121,7 @@
class NoopTestCommand(TestCommand):
def __init__(self, dist):
print("Matplotlib does not support running tests with "
"'python setup.py test'. Please run 'python tests.py'.")
"'python setup.py test'. Please run 'pytest'.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs you can run the tests with py.test or python tests.py.
Should the latter not be the case, one would need to update the docs as well. Else, the error could probably read

Please run 'python tests.py' or 'py.test'.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there was an attempt to migrate to py.test, and to deprecate disincentive python tests.py, in particular the documentation does not mention how to run a single test using python tests.py. So it seem to me that directly giving the right invocation.

If you look at previous PRs and comment (like https://github.com/matplotlib/matplotlib/pull/8026/files#r101600628), there seem to be some consensus that pytest is prefered and should replace python tests.py where possible.

Also

In [1]: import this
...
There should be one-- and preferably only one --obvious way to do it.
...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Carreau all of the pytest CLI args pass through.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ll of the pytest CLI args pass through.

Oh, ok, well the old doc was not saying that, and giving innacurate information.
Thanks for merging. I think that having pytest everywhere but still have the python tests.py as a alias is great !

@NelleV NelleV requested a review from ivanov August 4, 2018 22:42
@NelleV
Copy link
Member

NelleV commented Aug 4, 2018

Thanks a lot for the contribution @eseiver ! As you may see, I've pushed some changes to your branch as we discussed in person earlier today. I think we've almost done with this pull request. @ivanov has agreed to review it as well.
I've left tests.py so far, but if all the functionalities are covered with pytest (which I believe they are), we should also be a go to remove it!

Copy link
Member

@ivanov ivanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you for your first contrbution, @eseiver ! I love that we're moving to pytest with this. Since the tests are passing, I'm happy with this as is. If we want to add a note to test.py to denote the fact that it is no longer being used, that would help us. Down the line, we'll be removing it altogether, but there's no rush for that.

@tacaswell tacaswell added this to the v2.2.4 milestone Aug 5, 2018
@tacaswell
Copy link
Member

grumble I still like python tests.py better, but I think all of the configuration we used to do there has moved in various configuration files and we no longer support any version of Matplotlib that uses nose so I am out of technical reasons.

Would it be better to do python -mpytest?

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modulo outcome of pytest vs python -mpytest discussion.

@choldgraf
Copy link
Contributor

@tacaswell how do you feel about nailing this down in a subsequent PR? I think this PR is an improvement and tests look happy so I think we should let @eseiver off the hook for more nuanced testing changes :-)

@tacaswell tacaswell modified the milestones: v2.2.4, v2.2.3 Aug 5, 2018
@tacaswell
Copy link
Member

This is fine with me.

@choldgraf
Copy link
Contributor

ok cool, I'm gonna merge this one! Thanks @eseiver for your first matplotlib commit :-D

@choldgraf choldgraf merged commit 70e7850 into matplotlib:master Aug 5, 2018
@lumberbot-app
Copy link

lumberbot-app bot commented Aug 5, 2018

There seem to be a conflict, please backport manually

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants