3
3
"""
4
4
from __future__ import absolute_import , division , print_function
5
5
import collections
6
+ import os
6
7
import sys
7
8
import textwrap
8
9
@@ -472,7 +473,7 @@ def test_three():
472
473
473
474
def test_show_deselected_items_using_markexpr_before_test_execution (self , testdir ):
474
475
testdir .makepyfile (
475
- """
476
+ test_show_deselected = """
476
477
import pytest
477
478
478
479
@pytest.mark.foo
@@ -491,7 +492,7 @@ def test_pass():
491
492
result .stdout .fnmatch_lines (
492
493
[
493
494
"collected 3 items / 1 deselected" ,
494
- "*test_show_des* .py ..*" ,
495
+ "*test_show_deselected .py ..*" ,
495
496
"*= 2 passed, 1 deselected in * =*" ,
496
497
]
497
498
)
@@ -1134,7 +1135,53 @@ def test_no_trailing_whitespace_after_inifile_word(testdir):
1134
1135
assert "inifile: tox.ini\n " in result .stdout .str ()
1135
1136
1136
1137
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 ):
1138
1185
@pytest .fixture
1139
1186
def many_tests_files (self , testdir ):
1140
1187
testdir .makepyfile (
0 commit comments