Revisit pytest config

- add testpaths setting
- tox: remove testpaths from posargs default
- s/py.test/pytest/
This commit is contained in:
Daniel Hahler
2018-06-30 19:14:13 +02:00
parent a79a1fbef5
commit a34ee5bb92
5 changed files with 13 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ collect_ignore = [
# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
# has no effect during doctests. Without these hooks, doctests uses
# user's cache (e.g., ~/.cache/jedi/). We should remove this
# workaround once the problem is fixed in py.test.
# workaround once the problem is fixed in pytest.
#
# See:
# - https://github.com/davidhalter/jedi/pull/168

View File

@@ -10,3 +10,5 @@ norecursedirs = .* docs completion refactor absolute_import namespace_package
# fine as long as we are using `clean_jedi_cache` as a session scoped
# fixture.
usefixtures = clean_jedi_cache
testpaths = jedi test

View File

@@ -18,7 +18,7 @@ How to run tests?
+++++++++++++++++
Jedi uses pytest_ to run unit and integration tests. To run tests,
simply run ``py.test``. You can also use tox_ to run tests for
simply run ``pytest``. You can also use tox_ to run tests for
multiple Python versions.
.. _pytest: http://pytest.org
@@ -30,7 +30,7 @@ definitions), ``#!`` (assignments), or ``#<`` (usages).
There is also support for third party libraries. In a normal test run they are
not being executed, you have to provide a ``--thirdparty`` option.
In addition to standard `-k` and `-m` options in py.test, you can use
In addition to standard `-k` and `-m` options in pytest, you can use the
`-T` (`--test-files`) option to specify integration test cases to run.
It takes the format of ``FILE_NAME[:LINE[,LINE[,...]]]`` where
``FILE_NAME`` is a file in ``test/completion`` and ``LINE`` is a line
@@ -38,20 +38,20 @@ number of the test comment. Here is some recipes:
Run tests only in ``basic.py`` and ``imports.py``::
py.test test/test_integration.py -T basic.py -T imports.py
pytest test/test_integration.py -T basic.py -T imports.py
Run test at line 4, 6, and 8 in ``basic.py``::
py.test test/test_integration.py -T basic.py:4,6,8
pytest test/test_integration.py -T basic.py:4,6,8
See ``py.test --help`` for more information.
See ``pytest --help`` for more information.
If you want to debug a test, just use the ``--pdb`` option.
Alternate Test Runner
+++++++++++++++++++++
If you don't like the output of ``py.test``, there's an alternate test runner
If you don't like the output of ``pytest``, there's an alternate test runner
that you can start by running ``./run.py``. The above example could be run by::
./run.py basic 4 6 8 50-80

View File

@@ -9,9 +9,9 @@ def assert_case_equal(case, actual, desired):
"""
Assert ``actual == desired`` with formatted message.
This is not needed for typical py.test use case, but as we need
This is not needed for typical pytest use case, but as we need
``--assert=plain`` (see ../pytest.ini) to workaround some issue
due to py.test magic, let's format the message by hand.
due to pytest magic, let's format the message by hand.
"""
assert actual == desired, """
Test %r failed.

View File

@@ -25,7 +25,7 @@ setenv =
env36: JEDI_TEST_ENVIRONMENT=36
env37: JEDI_TEST_ENVIRONMENT=37
commands =
py.test {posargs:jedi test}
pytest {posargs}
[testenv:py27]
deps =
# for testing the typing module
@@ -56,7 +56,7 @@ deps =
numpydoc
{[testenv]deps}
commands =
coverage run --source jedi -m py.test
coverage run --source jedi -m pytest
coverage report
[testenv:sith]
commands =