Merge pull request #1565 from tomviner/issue1544/ignore-build-dist-dirs

Issue 1544: norecursedirs build & dist dirs
This commit is contained in:
Bruno Oliveira 2016-05-23 19:30:20 -03:00
commit 5ab5a11544
4 changed files with 11 additions and 2 deletions

View File

@ -52,6 +52,11 @@
the user to check the name of the test module/package(s). the user to check the name of the test module/package(s).
Thanks `@omarkohl`_ for the complete PR (`#1520`_). Thanks `@omarkohl`_ for the complete PR (`#1520`_).
* Add ``build/`` and ``dist/`` to the default ``--norecursedirs`` list. Thanks
`@mikofski`_ for the report and `@tomviner`_ for the PR (`#1544`_).
*
.. _@milliams: https://github.com/milliams .. _@milliams: https://github.com/milliams
.. _@novas0x2a: https://github.com/novas0x2a .. _@novas0x2a: https://github.com/novas0x2a
.. _@kalekundert: https://github.com/kalekundert .. _@kalekundert: https://github.com/kalekundert
@ -59,6 +64,7 @@
.. _@ceridwen: https://github.com/ceridwen .. _@ceridwen: https://github.com/ceridwen
.. _@palaviv: https://github.com/palaviv .. _@palaviv: https://github.com/palaviv
.. _@omarkohl: https://github.com/omarkohl .. _@omarkohl: https://github.com/omarkohl
.. _@mikofski: https://github.com/mikofski
.. _#1426: https://github.com/pytest-dev/pytest/issues/1426 .. _#1426: https://github.com/pytest-dev/pytest/issues/1426
.. _#1428: https://github.com/pytest-dev/pytest/pull/1428 .. _#1428: https://github.com/pytest-dev/pytest/pull/1428
@ -71,6 +77,7 @@
.. _#1502: https://github.com/pytest-dev/pytest/pull/1502 .. _#1502: https://github.com/pytest-dev/pytest/pull/1502
.. _#1520: https://github.com/pytest-dev/pytest/pull/1520 .. _#1520: https://github.com/pytest-dev/pytest/pull/1520
.. _#372: https://github.com/pytest-dev/pytest/issues/372 .. _#372: https://github.com/pytest-dev/pytest/issues/372
.. _#1544: https://github.com/pytest-dev/pytest/issues/1544
2.9.2.dev1 2.9.2.dev1
========== ==========

View File

@ -29,7 +29,7 @@ name_re = re.compile("^[a-zA-Z_]\w*$")
def pytest_addoption(parser): def pytest_addoption(parser):
parser.addini("norecursedirs", "directory patterns to avoid for recursion", parser.addini("norecursedirs", "directory patterns to avoid for recursion",
type="args", default=['.*', 'CVS', '_darcs', '{arch}', '*.egg']) type="args", default=['.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg'])
parser.addini("testpaths", "directories to search for tests when no files or directories are given in the command line.", parser.addini("testpaths", "directories to search for tests when no files or directories are given in the command line.",
type="args", default=[]) type="args", default=[])
#parser.addini("dirpatterns", #parser.addini("dirpatterns",

View File

@ -144,7 +144,7 @@ Builtin configuration file options
[seq] matches any character in seq [seq] matches any character in seq
[!seq] matches any char not in seq [!seq] matches any char not in seq
Default patterns are ``'.*', 'CVS', '_darcs', '{arch}', '*.egg'``. Default patterns are ``'.*', 'build', 'dist', 'CVS', '_darcs', '{arch}', '*.egg'``.
Setting a ``norecursedirs`` replaces the default. Here is an example of Setting a ``norecursedirs`` replaces the default. Here is an example of
how to avoid certain directories: how to avoid certain directories:

View File

@ -88,6 +88,8 @@ class TestCollector:
class TestCollectFS: class TestCollectFS:
def test_ignored_certain_directories(self, testdir): def test_ignored_certain_directories(self, testdir):
tmpdir = testdir.tmpdir tmpdir = testdir.tmpdir
tmpdir.ensure("build", 'test_notfound.py')
tmpdir.ensure("dist", 'test_notfound.py')
tmpdir.ensure("_darcs", 'test_notfound.py') tmpdir.ensure("_darcs", 'test_notfound.py')
tmpdir.ensure("CVS", 'test_notfound.py') tmpdir.ensure("CVS", 'test_notfound.py')
tmpdir.ensure("{arch}", 'test_notfound.py') tmpdir.ensure("{arch}", 'test_notfound.py')