From 856d9cf06fac9366f82f998ad4caefef177f1a1e Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Fri, 17 Feb 2012 12:09:37 +0100 Subject: sync pytest with the 2.2.3 release --- _pytest/__init__.py | 2 +- _pytest/main.py | 2 +- _pytest/python.py | 8 +++++--- _pytest/runner.py | 2 ++ _pytest/terminal.py | 16 ++++++++++++---- 5 files changed, 21 insertions(+), 9 deletions(-) (limited to '_pytest') diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 0a695c2035..6c2941d5d5 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.2.dev6' +__version__ = '2.2.3' diff --git a/_pytest/main.py b/_pytest/main.py index f6354205b0..7ac673cf39 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -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)) diff --git a/_pytest/python.py b/_pytest/python.py index 7705249846..5289fe6f50 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -629,9 +629,11 @@ class Metafunc: if not isinstance(argnames, (tuple, list)): argnames = (argnames,) argvalues = [(val,) for val in argvalues] - for arg in argnames: - if arg not in self.funcargnames: - raise ValueError("%r has no argument %r" %(self.function, arg)) + if not indirect: + #XXX should we also check for the opposite case? + for arg in argnames: + if arg not in self.funcargnames: + raise ValueError("%r has no argument %r" %(self.function, arg)) valtype = indirect and "params" or "funcargs" if not ids: idmaker = IDMaker() diff --git a/_pytest/runner.py b/_pytest/runner.py index 048ca1dd9b..f9f203ffab 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -47,6 +47,8 @@ def pytest_terminal_summary(terminalreporter): def pytest_sessionstart(session): session._setupstate = SetupState() +def pytest_sessionfinish(session): + session._setupstate.teardown_all() class NodeInfo: def __init__(self, location): diff --git a/_pytest/terminal.py b/_pytest/terminal.py index 5245f339bb..6446ac7064 100644 --- a/_pytest/terminal.py +++ b/_pytest/terminal.py @@ -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 = "" -- cgit v1.2.3-65-gdbad