Merge pull request #1168 from hackebrot/write-docs-on-ignore-cli-option
Write docs on ignore cli option
This commit is contained in:
commit
a1d226b751
|
@ -1,6 +1,45 @@
|
|||
Changing standard (Python) test discovery
|
||||
===============================================
|
||||
|
||||
Ignore paths during test collection
|
||||
-----------------------------------
|
||||
|
||||
You can easily ignore certain test directories and modules during collection
|
||||
by passing the ``--ignore=path`` option on the cli. ``pytest`` allows multiple
|
||||
``--ignore`` options. Example::
|
||||
|
||||
tests/
|
||||
├── example
|
||||
│ ├── test_example_01.py
|
||||
│ ├── test_example_02.py
|
||||
│ └── test_example_03.py
|
||||
├── foobar
|
||||
│ ├── test_foobar_01.py
|
||||
│ ├── test_foobar_02.py
|
||||
│ └── test_foobar_03.py
|
||||
└── hello
|
||||
└── world
|
||||
├── test_world_01.py
|
||||
├── test_world_02.py
|
||||
└── test_world_03.py
|
||||
|
||||
Now if you invoke ``pytest`` with ``--ignore=tests/foobar/test_foobar_03.py --ignore=tests/hello/``,
|
||||
you will see that ``pytest`` only collects test-modules, which do not match the patterns specified::
|
||||
|
||||
========= test session starts ==========
|
||||
platform darwin -- Python 2.7.10, pytest-2.8.2, py-1.4.30, pluggy-0.3.1
|
||||
rootdir: $REGENDOC_TMPDIR, inifile:
|
||||
collected 5 items
|
||||
|
||||
tests/example/test_example_01.py .
|
||||
tests/example/test_example_02.py .
|
||||
tests/example/test_example_03.py .
|
||||
tests/foobar/test_foobar_01.py .
|
||||
tests/foobar/test_foobar_02.py .
|
||||
|
||||
======= 5 passed in 0.02 seconds =======
|
||||
|
||||
|
||||
Changing directory recursion
|
||||
-----------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue