forked from VimPlug/jedi
Revisit pytest config
- add testpaths setting - tox: remove testpaths from posargs default - s/py.test/pytest/
This commit is contained in:
@@ -22,7 +22,7 @@ collect_ignore = [
|
|||||||
# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
|
# to modify `jedi.settings.cache_directory` because `clean_jedi_cache`
|
||||||
# has no effect during doctests. Without these hooks, doctests uses
|
# has no effect during doctests. Without these hooks, doctests uses
|
||||||
# user's cache (e.g., ~/.cache/jedi/). We should remove this
|
# 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:
|
# See:
|
||||||
# - https://github.com/davidhalter/jedi/pull/168
|
# - https://github.com/davidhalter/jedi/pull/168
|
||||||
|
|||||||
@@ -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
|
# fine as long as we are using `clean_jedi_cache` as a session scoped
|
||||||
# fixture.
|
# fixture.
|
||||||
usefixtures = clean_jedi_cache
|
usefixtures = clean_jedi_cache
|
||||||
|
|
||||||
|
testpaths = jedi test
|
||||||
|
|||||||
12
test/run.py
12
test/run.py
@@ -18,7 +18,7 @@ How to run tests?
|
|||||||
+++++++++++++++++
|
+++++++++++++++++
|
||||||
|
|
||||||
Jedi uses pytest_ to run unit and integration tests. 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.
|
multiple Python versions.
|
||||||
|
|
||||||
.. _pytest: http://pytest.org
|
.. _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
|
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.
|
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.
|
`-T` (`--test-files`) option to specify integration test cases to run.
|
||||||
It takes the format of ``FILE_NAME[:LINE[,LINE[,...]]]`` where
|
It takes the format of ``FILE_NAME[:LINE[,LINE[,...]]]`` where
|
||||||
``FILE_NAME`` is a file in ``test/completion`` and ``LINE`` is a line
|
``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``::
|
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``::
|
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.
|
If you want to debug a test, just use the ``--pdb`` option.
|
||||||
|
|
||||||
Alternate Test Runner
|
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::
|
that you can start by running ``./run.py``. The above example could be run by::
|
||||||
|
|
||||||
./run.py basic 4 6 8 50-80
|
./run.py basic 4 6 8 50-80
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ def assert_case_equal(case, actual, desired):
|
|||||||
"""
|
"""
|
||||||
Assert ``actual == desired`` with formatted message.
|
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
|
``--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, """
|
assert actual == desired, """
|
||||||
Test %r failed.
|
Test %r failed.
|
||||||
|
|||||||
4
tox.ini
4
tox.ini
@@ -25,7 +25,7 @@ setenv =
|
|||||||
env36: JEDI_TEST_ENVIRONMENT=36
|
env36: JEDI_TEST_ENVIRONMENT=36
|
||||||
env37: JEDI_TEST_ENVIRONMENT=37
|
env37: JEDI_TEST_ENVIRONMENT=37
|
||||||
commands =
|
commands =
|
||||||
py.test {posargs:jedi test}
|
pytest {posargs}
|
||||||
[testenv:py27]
|
[testenv:py27]
|
||||||
deps =
|
deps =
|
||||||
# for testing the typing module
|
# for testing the typing module
|
||||||
@@ -56,7 +56,7 @@ deps =
|
|||||||
numpydoc
|
numpydoc
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
commands =
|
commands =
|
||||||
coverage run --source jedi -m py.test
|
coverage run --source jedi -m pytest
|
||||||
coverage report
|
coverage report
|
||||||
[testenv:sith]
|
[testenv:sith]
|
||||||
commands =
|
commands =
|
||||||
|
|||||||
Reference in New Issue
Block a user