33"""
44from __future__ import absolute_import , division , print_function
55import collections
6+ import os
67import sys
78import textwrap
89
@@ -472,7 +473,7 @@ def test_three():
472473
473474 def test_show_deselected_items_using_markexpr_before_test_execution (self , testdir ):
474475 testdir .makepyfile (
475- """
476+ test_show_deselected = """
476477 import pytest
477478
478479 @pytest.mark.foo
@@ -491,7 +492,7 @@ def test_pass():
491492 result .stdout .fnmatch_lines (
492493 [
493494 "collected 3 items / 1 deselected" ,
494- "*test_show_des* .py ..*" ,
495+ "*test_show_deselected .py ..*" ,
495496 "*= 2 passed, 1 deselected in * =*" ,
496497 ]
497498 )
@@ -1134,7 +1135,53 @@ def test_no_trailing_whitespace_after_inifile_word(testdir):
11341135 assert "inifile: tox.ini\n " in result .stdout .str ()
11351136
11361137
1137- class TestProgress (object ):
1138+ class TestClassicOutputStyle (object ):
1139+ """Ensure classic output style works as expected (#3883)"""
1140+
1141+ @pytest .fixture
1142+ def test_files (self , testdir ):
1143+ testdir .makepyfile (
1144+ ** {
1145+ "test_one.py" : "def test_one(): pass" ,
1146+ "test_two.py" : "def test_two(): assert 0" ,
1147+ "sub/test_three.py" : """
1148+ def test_three_1(): pass
1149+ def test_three_2(): assert 0
1150+ def test_three_3(): pass
1151+ """ ,
1152+ }
1153+ )
1154+
1155+ def test_normal_verbosity (self , testdir , test_files ):
1156+ result = testdir .runpytest ("-o" , "console_output_style=classic" )
1157+ result .stdout .fnmatch_lines (
1158+ [
1159+ "test_one.py ." ,
1160+ "test_two.py F" ,
1161+ "sub{}test_three.py .F." .format (os .sep ),
1162+ "*2 failed, 3 passed in*" ,
1163+ ]
1164+ )
1165+
1166+ def test_verbose (self , testdir , test_files ):
1167+ result = testdir .runpytest ("-o" , "console_output_style=classic" , "-v" )
1168+ result .stdout .fnmatch_lines (
1169+ [
1170+ "test_one.py::test_one PASSED" ,
1171+ "test_two.py::test_two FAILED" ,
1172+ "sub{}test_three.py::test_three_1 PASSED" .format (os .sep ),
1173+ "sub{}test_three.py::test_three_2 FAILED" .format (os .sep ),
1174+ "sub{}test_three.py::test_three_3 PASSED" .format (os .sep ),
1175+ "*2 failed, 3 passed in*" ,
1176+ ]
1177+ )
1178+
1179+ def test_quiet (self , testdir , test_files ):
1180+ result = testdir .runpytest ("-o" , "console_output_style=classic" , "-q" )
1181+ result .stdout .fnmatch_lines ([".F.F." , "*2 failed, 3 passed in*" ])
1182+
1183+
1184+ class TestProgressOutputStyle (object ):
11381185 @pytest .fixture
11391186 def many_tests_files (self , testdir ):
11401187 testdir .makepyfile (
0 commit comments