more quit collectonly shows only files and the number of tests in them

This commit is contained in:
Ronny Pfannschmidt 2012-02-03 16:56:06 +01:00
parent 68b353be0d
commit 78e7d7aed0
3 changed files with 26 additions and 1019 deletions

1015
CHANGELOG

File diff suppressed because it is too large Load Diff

View File

@ -282,10 +282,18 @@ class TerminalReporter:
# we take care to leave out Instances aka () # we take care to leave out Instances aka ()
# because later versions are going to get rid of them anyway # because later versions are going to get rid of them anyway
if self.config.option.verbose < 0: if self.config.option.verbose < 0:
for item in items: if self.config.option.verbose < -1:
nodeid = item.nodeid counts = {}
nodeid = nodeid.replace("::()::", "::") for item in items:
self._tw.line(nodeid) 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 return
stack = [] stack = []
indent = "" indent = ""

View File

@ -267,6 +267,20 @@ class TestCollectonly:
'*ERROR: file not found*', '*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): def test_repr_python_version(monkeypatch):
try: try: