Merge branch 'master' into 'features'

This commit is contained in:
Bruno Oliveira 2016-01-08 21:51:34 -02:00
commit b8784c28c9
4 changed files with 25 additions and 5 deletions

View File

@ -63,6 +63,10 @@
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
properly displayed.
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
2.8.5
=====

View File

@ -365,15 +365,14 @@ class TerminalReporter:
EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, EXIT_USAGEERROR,
EXIT_NOTESTSCOLLECTED)
if exitstatus in summary_exit_codes:
self.config.hook.pytest_terminal_summary(terminalreporter=self)
self.summary_errors()
self.summary_failures()
self.summary_warnings()
self.summary_passes()
self.config.hook.pytest_terminal_summary(terminalreporter=self)
if exitstatus == EXIT_INTERRUPTED:
self._report_keyboardinterrupt()
del self._keyboardinterrupt_memo
self.summary_deselected()
self.summary_stats()

View File

@ -436,7 +436,7 @@ marking platform specific tests with pytest
.. regendoc:wipe
Consider you have a test suite which marks tests for particular platforms,
namely ``pytest.mark.osx``, ``pytest.mark.win32`` etc. and you
namely ``pytest.mark.darwin``, ``pytest.mark.win32`` etc. and you
also have tests that run on all platforms and have no specific
marker. If you now want to have a way to only run the tests
for your particular platform, you could use the following plugin::
@ -446,7 +446,7 @@ for your particular platform, you could use the following plugin::
import sys
import pytest
ALL = set("osx linux2 win32".split())
ALL = set("darwin linux2 win32".split())
def pytest_runtest_setup(item):
if isinstance(item, item.Function):
@ -462,7 +462,7 @@ Let's do a little test file to show how this looks like::
import pytest
@pytest.mark.osx
@pytest.mark.darwin
def test_if_apple_is_evil():
pass

View File

@ -766,6 +766,23 @@ def test_terminal_summary(testdir):
world
""")
def test_terminal_summary_warnings_are_displayed(testdir):
"""Test that warnings emitted during pytest_terminal_summary are displayed.
(#1305).
"""
testdir.makeconftest("""
def pytest_terminal_summary(terminalreporter):
config = terminalreporter.config
config.warn('C1', 'internal warning')
""")
result = testdir.runpytest('-rw')
result.stdout.fnmatch_lines([
'*C1*internal warning',
'*== 1 pytest-warnings in *',
])
@pytest.mark.parametrize("exp_color, exp_line, stats_arg", [
# The method under test only cares about the length of each
# dict value, not the actual contents, so tuples of anything