diff --git a/conftest.py b/conftest.py index 60af4158..500799ec 100644 --- a/conftest.py +++ b/conftest.py @@ -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 diff --git a/pytest.ini b/pytest.ini index d4e0f467..8730a97e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -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 diff --git a/test/run.py b/test/run.py index 0e6da5a4..611fba6e 100755 --- a/test/run.py +++ b/test/run.py @@ -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 diff --git a/test/test_integration.py b/test/test_integration.py index a7ee2530..04fbd48e 100644 --- a/test/test_integration.py +++ b/test/test_integration.py @@ -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. diff --git a/tox.ini b/tox.ini index 9ecda0fd..35e18d9c 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =