From 45e10f4c48520a0a2fba91f61d3344976e8e09fa Mon Sep 17 00:00:00 2001 From: holger krekel Date: Sun, 2 May 2010 15:24:02 +0200 Subject: [PATCH] rename pytest_ignore_collect_path to pytest_ignore_collect before release --HG-- branch : trunk --- CHANGELOG | 4 ++-- doc/test/customize.txt | 4 ++-- py/_plugin/hookspec.py | 4 ++-- py/_plugin/pytest_default.py | 2 +- py/_test/collect.py | 2 +- testing/test_collect.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f1a196b80..2d66258ab 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 - (issue87) fix unboundlocal error in assertionold code - (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 - 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) to prevent even a collection try of any tests in symlinked dirs. - new pytest_pycollect_makemodule(path, parent) hook for diff --git a/doc/test/customize.txt b/doc/test/customize.txt index 02ae0c090..85fbe441c 100644 --- a/doc/test/customize.txt +++ b/doc/test/customize.txt @@ -95,8 +95,8 @@ per-test run basetemp directory. .. _`function arguments`: funcargs.html .. _`extensions`: -Plugin basics -========================= +Plugin basics and project configuration +============================================= .. _`local plugin`: diff --git a/py/_plugin/hookspec.py b/py/_plugin/hookspec.py index 8d8ae18b0..691070d32 100644 --- a/py/_plugin/hookspec.py +++ b/py/_plugin/hookspec.py @@ -27,12 +27,12 @@ def pytest_unconfigure(config): # 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. This hook is consulted for all files and directories prior to considering collection hooks. """ -pytest_ignore_collect_path.firstresult = True +pytest_ignore_collect.firstresult = True def pytest_collect_directory(path, parent): """ return Collection node or None for the given path. """ diff --git a/py/_plugin/pytest_default.py b/py/_plugin/pytest_default.py index b5142ef86..3d3af3521 100644 --- a/py/_plugin/pytest_default.py +++ b/py/_plugin/pytest_default.py @@ -28,7 +28,7 @@ def pytest_funcarg__pytestconfig(request): """ the pytest config object with access to command line opts.""" 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 = ignore_paths or [] excludeopt = config.getvalue("ignore") diff --git a/py/_test/collect.py b/py/_test/collect.py index a1fb4e509..7242b7dd8 100644 --- a/py/_test/collect.py +++ b/py/_test/collect.py @@ -297,7 +297,7 @@ class Directory(FSCollector): return l 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 if path.check(file=1): res = self.consider_file(path) diff --git a/testing/test_collect.py b/testing/test_collect.py index 6295418e8..4c338568d 100644 --- a/testing/test_collect.py +++ b/testing/test_collect.py @@ -159,7 +159,7 @@ class TestPrunetraceback: class TestCustomConftests: def test_ignore_collect_path(self, testdir): testdir.makeconftest(""" - def pytest_ignore_collect_path(path, config): + def pytest_ignore_collect(path, config): return path.basename.startswith("x") or \ path.basename == "test_one.py" """)