diff --git a/_pytest/__init__.py b/_pytest/__init__.py index 03f7952fe..8159b045e 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.0.dev3' +__version__ = '2.2.0.dev4' diff --git a/_pytest/runner.py b/_pytest/runner.py index e91ebede3..7f0fc63bf 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -28,11 +28,10 @@ def pytest_terminal_summary(terminalreporter): duration2rep = {} alldurations = 0.0 for key, replist in tr.stats.items(): - if key == "deselected": - continue for rep in replist: - duration2rep[rep.duration] = rep - alldurations += rep.duration + if hasattr(rep, 'duration'): + duration2rep[rep.duration] = rep + alldurations += rep.duration if not duration2rep: return d2 = list(duration2rep.items()) diff --git a/setup.py b/setup.py index 76c83bcee..44020707a 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ def main(): name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.2.0.dev3', + version='2.2.0.dev4', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 6a19160b7..299b016e6 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -523,6 +523,16 @@ class TestDurations: "*call*test_1*", ]) + def test_with_failing_collection(self, testdir): + testdir.makepyfile(self.source) + testdir.makepyfile(test_collecterror="""xyz""") + result = testdir.runpytest("--durations=2", "-k test_1") + assert result.ret != 0 + result.stdout.fnmatch_lines([ + "*durations*", + "*call*test_1*", + ]) + class TestDurationWithFixture: source = """