nicer error message for non-collectable test files / items
fixes issue #27 --HG-- branch : 1.0.x
This commit is contained in:
@@ -167,16 +167,13 @@ class Node(object):
|
||||
if colitem.fspath == fspath or colitem.name == basename:
|
||||
l.append(colitem)
|
||||
if not l:
|
||||
msg = ("Collector %r does not provide %r colitem "
|
||||
"existing colitems are: %s" %
|
||||
(cur, fspath, colitems))
|
||||
raise AssertionError(msg)
|
||||
raise self.config.Error("can't collect: %s" %(fspath,))
|
||||
if basenames:
|
||||
if len(l) > 1:
|
||||
msg = ("Collector %r has more than one %r colitem "
|
||||
"existing colitems are: %s" %
|
||||
(cur, fspath, colitems))
|
||||
raise AssertionError(msg)
|
||||
raise self.config.Error("xxx-too many test types for: %s" % (fspath, ))
|
||||
cur = l[0]
|
||||
else:
|
||||
if len(l) > 1:
|
||||
|
||||
@@ -67,3 +67,12 @@ class TestGeneralUsage:
|
||||
"E ImportError: No module named does_not_work",
|
||||
])
|
||||
assert result.ret == 1
|
||||
|
||||
def test_not_collectable_arguments(self, testdir):
|
||||
p1 = testdir.makepyfile("")
|
||||
p2 = testdir.makefile(".pyc", "123")
|
||||
result = testdir.runpytest(p1, p2)
|
||||
assert result.ret != 0
|
||||
assert result.stderr.fnmatch_lines([
|
||||
"*ERROR: can't collect: %s" %(p2,)
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user