diff --git a/CHANGELOG b/CHANGELOG index 439df61be..ebdb57e4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -55,6 +55,7 @@ Bug fixes / Maintenance get canonical script paths in virtualenv situations - make path.bestrelpath(path) return ".", note that when calling X.bestrelpath the assumption is that X is a directory. +- make initial conftest discovery ignore "--" prefixed arguments Changes between 1.3.0 and 1.3.1 ================================================== diff --git a/py/_test/conftesthandle.py b/py/_test/conftesthandle.py index 8c345eb37..9461e01ed 100644 --- a/py/_test/conftesthandle.py +++ b/py/_test/conftesthandle.py @@ -36,6 +36,8 @@ class Conftest(object): self._confcutdir = p break for arg in args + [current]: + if hasattr(arg, 'startswith') and arg.startswith("--"): + continue anchor = current.join(arg, abs=1) if anchor.check(): # we found some file object self._path2confmods[None] = self.getconftestmodules(anchor) diff --git a/testing/test_conftesthandle.py b/testing/test_conftesthandle.py index 65ee13504..b017835b8 100644 --- a/testing/test_conftesthandle.py +++ b/testing/test_conftesthandle.py @@ -98,6 +98,14 @@ def test_conftest_in_nonpkg_with_init(tmpdir): tmpdir.ensure("adir-1.0/__init__.py") conftest = ConftestWithSetinitial(tmpdir.join("adir-1.0", "b")) +def test_doubledash_not_considered(testdir): + conf = testdir.mkdir("--option") + conf.join("conftest.py").ensure() + conftest = Conftest() + conftest.setinitial([conf.basename, conf.basename]) + l = conftest.getconftestmodules(None) + assert len(l) == 0 + def test_conftestcutdir(testdir): conf = testdir.makeconftest("") p = testdir.mkdir("x")