diff options
Diffstat (limited to 'doc/source')
-rw-r--r-- | doc/source/dev/development_environment.rst | 25 | ||||
-rw-r--r-- | doc/source/reference/routines.testing.rst | 14 | ||||
-rw-r--r-- | doc/source/reference/testing.rst | 7 |
3 files changed, 31 insertions, 15 deletions
diff --git a/doc/source/dev/development_environment.rst b/doc/source/dev/development_environment.rst index f4c6f3ec7..0c9f307f8 100644 --- a/doc/source/dev/development_environment.rst +++ b/doc/source/dev/development_environment.rst @@ -3,7 +3,6 @@ Setting up and using your development environment ================================================= - Recommended development setup ----------------------------- @@ -22,7 +21,7 @@ do one of:: $ python runtests.py -v $ python runtests.py -v -s random - $ python runtests.py -v -t numpy/core/tests/test_iter.py:test_iter_c_order + $ python runtests.py -v -t numpy/core/tests/test_nditer.py::test_iter_c_order $ python runtests.py --ipython $ python runtests.py --python somescript.py $ python runtests.py --bench @@ -35,10 +34,15 @@ any) found on current PYTHONPATH. When specifying a target using ``-s``, ``-t``, or ``--python``, additional arguments may be forwarded to the target embedded by ``runtests.py`` by passing the extra arguments after a bare ``--``. For example, to run a test method with -the ``--pdb`` flag forwarded to nose, run the following:: +the ``--pdb`` flag forwarded to the target, run the following:: $ python runtests.py -t numpy/tests/test_scripts.py:test_f2py -- --pdb +When using pytest as a target (the default), you can +`match test names using python operators`_ by passing the ``-k`` argument to pytest:: + + $ python runtests.py -v -t numpy/core/tests/test_multiarray.py -- -k "MatMul and not vector" + Using ``runtests.py`` is the recommended approach to running tests. There are also a number of alternatives to it, for example in-place build or installing to a virtualenv. See the FAQ below for details. @@ -123,9 +127,8 @@ Or a similar way from the command line:: $ python -c "import numpy as np; np.test()" -Tests can also be run with ``nosetests numpy``, however then the NumPy-specific -``nose`` plugin is not found which causes tests marked as ``KnownFailure`` to -be reported as errors. +Tests can also be run with ``pytest numpy``, however then the NumPy-specific +plugin is not found which causes strange side effects Running individual test files can be useful; it's much faster than running the whole test suite or that of a whole module (example: ``np.random.test()``). @@ -141,10 +144,9 @@ run the test suite with Python 3.4, use:: $ tox -e py34 -For more extensive info on running and writing tests, see -https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt . +For more extensive information, see :ref:`testing-guidelines` -*Note: do not run the tests from the root directory of your numpy git repo, +*Note: do not run the tests from the root directory of your numpy git repo without ``runtests.py``, that will result in strange test errors.* @@ -202,14 +204,11 @@ typically packaged as ``python-dbg``) is highly recommended. .. _DebuggingWithGdb: https://wiki.python.org/moin/DebuggingWithGdb - .. _tox: https://tox.readthedocs.io/ - .. _virtualenv: http://www.virtualenv.org/ - .. _virtualenvwrapper: http://www.doughellmann.com/projects/virtualenvwrapper/ - .. _Waf: https://code.google.com/p/waf/ +.. _`match test names using python operators`: https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests Understanding the code & getting started ---------------------------------------- diff --git a/doc/source/reference/routines.testing.rst b/doc/source/reference/routines.testing.rst index ad95bb399..5a52a40d6 100644 --- a/doc/source/reference/routines.testing.rst +++ b/doc/source/reference/routines.testing.rst @@ -1,3 +1,5 @@ +.. _numpy-testing: + Test Support (:mod:`numpy.testing`) =================================== @@ -6,8 +8,9 @@ Test Support (:mod:`numpy.testing`) Common test support for all numpy test scripts. This single module should provide all the common functionality for numpy -tests in a single location, so that test scripts can just import it and -work right away. +tests in a single location, so that :ref:`test scripts +<development-environment>` can just import it and work right away. For +background, see the :ref:`testing-guidelines` Asserts @@ -50,3 +53,10 @@ Test Running run_module_suite rundocs suppress_warnings + +Guidelines +---------- + +.. toctree:: + + testing diff --git a/doc/source/reference/testing.rst b/doc/source/reference/testing.rst new file mode 100644 index 000000000..72780dd44 --- /dev/null +++ b/doc/source/reference/testing.rst @@ -0,0 +1,7 @@ +.. _testing-guidelines: + +Testing Guidelines +================== + +.. include:: ../../TESTS.rst.txt + :start-line: 6 |