Skip to content

Commit b8784c2

Browse files
committed
Merge branch 'master' into 'features'
2 parents eebf5c1 + 29b05c8 commit b8784c2

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

CHANGELOG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
- fix #1292: monkeypatch calls (setattr, setenv, etc.) are now O(1).
6464
Thanks David R. MacIver for the report and Bruno Oliveira for the PR.
6565

66+
- fix #1305: pytest warnings emitted during ``pytest_terminal_summary`` are now
67+
properly displayed.
68+
Thanks Ionel Maries Cristian for the report and Bruno Oliveira for the PR.
69+
6670

6771
2.8.5
6872
=====

_pytest/terminal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,15 +365,14 @@ def pytest_sessionfinish(self, exitstatus):
365365
EXIT_OK, EXIT_TESTSFAILED, EXIT_INTERRUPTED, EXIT_USAGEERROR,
366366
EXIT_NOTESTSCOLLECTED)
367367
if exitstatus in summary_exit_codes:
368+
self.config.hook.pytest_terminal_summary(terminalreporter=self)
368369
self.summary_errors()
369370
self.summary_failures()
370371
self.summary_warnings()
371372
self.summary_passes()
372-
self.config.hook.pytest_terminal_summary(terminalreporter=self)
373373
if exitstatus == EXIT_INTERRUPTED:
374374
self._report_keyboardinterrupt()
375375
del self._keyboardinterrupt_memo
376-
377376
self.summary_deselected()
378377
self.summary_stats()
379378

doc/en/example/markers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ marking platform specific tests with pytest
436436
.. regendoc:wipe
437437
438438
Consider you have a test suite which marks tests for particular platforms,
439-
namely ``pytest.mark.osx``, ``pytest.mark.win32`` etc. and you
439+
namely ``pytest.mark.darwin``, ``pytest.mark.win32`` etc. and you
440440
also have tests that run on all platforms and have no specific
441441
marker. If you now want to have a way to only run the tests
442442
for your particular platform, you could use the following plugin::
@@ -446,7 +446,7 @@ for your particular platform, you could use the following plugin::
446446
import sys
447447
import pytest
448448

449-
ALL = set("osx linux2 win32".split())
449+
ALL = set("darwin linux2 win32".split())
450450

451451
def pytest_runtest_setup(item):
452452
if isinstance(item, item.Function):
@@ -462,7 +462,7 @@ Let's do a little test file to show how this looks like::
462462

463463
import pytest
464464

465-
@pytest.mark.osx
465+
@pytest.mark.darwin
466466
def test_if_apple_is_evil():
467467
pass
468468

testing/test_terminal.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,23 @@ def pytest_terminal_summary(terminalreporter):
766766
world
767767
""")
768768

769+
770+
def test_terminal_summary_warnings_are_displayed(testdir):
771+
"""Test that warnings emitted during pytest_terminal_summary are displayed.
772+
(#1305).
773+
"""
774+
testdir.makeconftest("""
775+
def pytest_terminal_summary(terminalreporter):
776+
config = terminalreporter.config
777+
config.warn('C1', 'internal warning')
778+
""")
779+
result = testdir.runpytest('-rw')
780+
result.stdout.fnmatch_lines([
781+
'*C1*internal warning',
782+
'*== 1 pytest-warnings in *',
783+
])
784+
785+
769786
@pytest.mark.parametrize("exp_color, exp_line, stats_arg", [
770787
# The method under test only cares about the length of each
771788
# dict value, not the actual contents, so tuples of anything

0 commit comments

Comments
 (0)