create session.items before preparse, so collectonly wont break on preparse fail, fixes #115
This commit is contained in:
parent
a756dc8106
commit
68b353be0d
|
@ -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
|
||||
----------------------------------------
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue