make initial conftest finding ignore "--" arguments

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-07-01 19:27:40 +02:00
parent 6fa58fd8c9
commit f554fa03ae
3 changed files with 11 additions and 0 deletions

View File

@ -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
==================================================

View File

@ -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)

View File

@ -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")