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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ test_script:
- python -c "import matplotlib as m; m.use('tkagg'); import matplotlib.pyplot as plt; print(plt.get_backend())"
# tests
- echo The following args are passed to pytest %PYTEST_ARGS%
- python tests.py %PYTEST_ARGS%
- pytest %PYTEST_ARGS%

after_test:
# After the tests were a success, build wheels with the static libs
Expand Down
2 changes: 1 addition & 1 deletion doc/devel/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ tools:
* Code with a good unittest coverage (at least 70%, better 100%), check with::

python -mpip install coverage
python tests.py --with-coverage
pytest --cov=matplotlib --showlocals -v

* No pyflakes warnings, check with::

Expand Down
3 changes: 2 additions & 1 deletion doc/devel/release_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ We use `travis-ci <https://travis-ci.org/matplotlib/matplotlib>`__ for
continuous integration. When preparing for a release, the final
tagged commit should be tested locally before it is uploaded::

python tests.py --processes=8 --process-timeout=300
pytest -n 8 .


In addition the following two tests should be run and manually inspected::

Expand Down
3 changes: 2 additions & 1 deletion doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Running the tests is simple. Make sure you have pytest installed and run::

or::

python tests.py
pytest .


in the root directory of the distribution. The script takes a set of
commands, such as:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 !



class BuildExtraLibraries(BuildExtCommand):
Expand Down
2 changes: 1 addition & 1 deletion tools/triage_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def launch(result_images, source):
Triage image comparison test failures.

If no arguments are provided, it assumes you ran the tests at the
top-level of a source checkout as `python tests.py`.
top-level of a source checkout as `pytest .`.

Keys:
left/right: Move between test, expected and diff images
Expand Down