create session.items before preparse, so collectonly wont break on preparse fail, fixes #115

This commit is contained in:
Ronny Pfannschmidt 2012-02-03 16:33:32 +01:00
parent a756dc8106
commit 68b353be0d
3 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,8 @@ Changes between 2.2.1 and 2.2.2.dev
- fix crash resulting from calling monkeypatch undo a second time
- extend reports accepting kwargs to set arbitrary additional attributes
this helps xdist serialization/deserialization of extended/customized reports
- fix issue115: make --collectonly robust against preparse failure
(missing files/directories)
Changes between 2.2.0 and 2.2.1
----------------------------------------

View File

@ -410,6 +410,7 @@ class Session(FSCollector):
self._notfound = []
self._initialpaths = set()
self._initialparts = []
self.items = items = []
for arg in args:
parts = self._parsearg(arg)
self._initialparts.append(parts)
@ -425,7 +426,6 @@ class Session(FSCollector):
if not genitems:
return rep.result
else:
self.items = items = []
if rep.passed:
for node in rep.result:
self.items.extend(self.genitems(node))

View File

@ -256,6 +256,17 @@ class TestCollectonly:
*1 error*
""").strip())
def test_collectonly_missing_path(self, testdir):
"""this checks issue 115,
failure in parseargs will cause session
not to have the items attribute
"""
result = testdir.runpytest("--collectonly", "uhm_missing_path")
assert result.ret == 3
result.stderr.fnmatch_lines([
'*ERROR: file not found*',
])
def test_repr_python_version(monkeypatch):
try: