rename pytest_ignore_collect_path to pytest_ignore_collect before release

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-05-02 15:24:02 +02:00
parent 3efb8028fb
commit 45e10f4c48
6 changed files with 9 additions and 9 deletions

View File

@ -13,10 +13,10 @@ Changes between 1.2.1 and 1.3.0 (release pending)
- fixes for handling of unicode exception values and unprintable objects - fixes for handling of unicode exception values and unprintable objects
- (issue87) fix unboundlocal error in assertionold code - (issue87) fix unboundlocal error in assertionold code
- (issue86) improve documentation for looponfailing - (issue86) improve documentation for looponfailing
- add a new pytest_ignore_collect_path(path, config) hook to allow projects and - add a new pytest_ignore_collect(path, config) hook to allow projects and
plugins to define exclusion behaviour for their directory structure - plugins to define exclusion behaviour for their directory structure -
for example you may define in a conftest.py this method: for example you may define in a conftest.py this method:
def pytest_ignore_collect_path(path): def pytest_ignore_collect(path):
return path.check(link=1) return path.check(link=1)
to prevent even a collection try of any tests in symlinked dirs. to prevent even a collection try of any tests in symlinked dirs.
- new pytest_pycollect_makemodule(path, parent) hook for - new pytest_pycollect_makemodule(path, parent) hook for

View File

@ -95,8 +95,8 @@ per-test run basetemp directory.
.. _`function arguments`: funcargs.html .. _`function arguments`: funcargs.html
.. _`extensions`: .. _`extensions`:
Plugin basics Plugin basics and project configuration
========================= =============================================
.. _`local plugin`: .. _`local plugin`:

View File

@ -27,12 +27,12 @@ def pytest_unconfigure(config):
# collection hooks # collection hooks
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
def pytest_ignore_collect_path(path, config): def pytest_ignore_collect(path, config):
""" return true value to prevent considering this path for collection. """ return true value to prevent considering this path for collection.
This hook is consulted for all files and directories prior to considering This hook is consulted for all files and directories prior to considering
collection hooks. collection hooks.
""" """
pytest_ignore_collect_path.firstresult = True pytest_ignore_collect.firstresult = True
def pytest_collect_directory(path, parent): def pytest_collect_directory(path, parent):
""" return Collection node or None for the given path. """ """ return Collection node or None for the given path. """

View File

@ -28,7 +28,7 @@ def pytest_funcarg__pytestconfig(request):
""" the pytest config object with access to command line opts.""" """ the pytest config object with access to command line opts."""
return request.config return request.config
def pytest_ignore_collect_path(path, config): def pytest_ignore_collect(path, config):
ignore_paths = config.getconftest_pathlist("collect_ignore", path=path) ignore_paths = config.getconftest_pathlist("collect_ignore", path=path)
ignore_paths = ignore_paths or [] ignore_paths = ignore_paths or []
excludeopt = config.getvalue("ignore") excludeopt = config.getvalue("ignore")

View File

@ -297,7 +297,7 @@ class Directory(FSCollector):
return l return l
def consider(self, path): def consider(self, path):
if self.ihook.pytest_ignore_collect_path(path=path, config=self.config): if self.ihook.pytest_ignore_collect(path=path, config=self.config):
return return
if path.check(file=1): if path.check(file=1):
res = self.consider_file(path) res = self.consider_file(path)

View File

@ -159,7 +159,7 @@ class TestPrunetraceback:
class TestCustomConftests: class TestCustomConftests:
def test_ignore_collect_path(self, testdir): def test_ignore_collect_path(self, testdir):
testdir.makeconftest(""" testdir.makeconftest("""
def pytest_ignore_collect_path(path, config): def pytest_ignore_collect(path, config):
return path.basename.startswith("x") or \ return path.basename.startswith("x") or \
path.basename == "test_one.py" path.basename == "test_one.py"
""") """)