more quit collectonly shows only files and the number of tests in them
This commit is contained in:
parent
68b353be0d
commit
78e7d7aed0
|
@ -282,10 +282,18 @@ class TerminalReporter:
|
|||
# we take care to leave out Instances aka ()
|
||||
# because later versions are going to get rid of them anyway
|
||||
if self.config.option.verbose < 0:
|
||||
for item in items:
|
||||
nodeid = item.nodeid
|
||||
nodeid = nodeid.replace("::()::", "::")
|
||||
self._tw.line(nodeid)
|
||||
if self.config.option.verbose < -1:
|
||||
counts = {}
|
||||
for item in items:
|
||||
name = item.nodeid.split('::', 1)[0]
|
||||
counts[name] = counts.get(name, 0) + 1
|
||||
for name, count in sorted(counts.items()):
|
||||
self._tw.line("%s: %d" % (name, count))
|
||||
else:
|
||||
for item in items:
|
||||
nodeid = item.nodeid
|
||||
nodeid = nodeid.replace("::()::", "::")
|
||||
self._tw.line(nodeid)
|
||||
return
|
||||
stack = []
|
||||
indent = ""
|
||||
|
|
|
@ -267,6 +267,20 @@ class TestCollectonly:
|
|||
'*ERROR: file not found*',
|
||||
])
|
||||
|
||||
def test_collectonly_quiet(self, testdir):
|
||||
testdir.makepyfile("def test_foo(): pass")
|
||||
result = testdir.runpytest("--collectonly", "-q")
|
||||
result.stdout.fnmatch_lines([
|
||||
'*test_foo*',
|
||||
])
|
||||
|
||||
def test_collectonly_more_quiet(self, testdir):
|
||||
testdir.makepyfile(test_fun="def test_foo(): pass")
|
||||
result = testdir.runpytest("--collectonly", "-qq")
|
||||
result.stdout.fnmatch_lines([
|
||||
'*test_fun.py: 1*',
|
||||
])
|
||||
|
||||
|
||||
def test_repr_python_version(monkeypatch):
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue