File tree Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Expand file tree Collapse file tree 3 files changed +29
-1
lines changed Original file line number Diff line number Diff line change
1
+ Fixed a crash when using :confval: `console_output_style ` with ``times `` and a module is skipped.
Original file line number Diff line number Diff line change @@ -734,7 +734,9 @@ def _get_progress_information_message(self) -> str:
734
734
last_in_module = tests_completed == tests_in_module
735
735
if self .showlongtestinfo or last_in_module :
736
736
self ._timing_nodeids_reported .update (r .nodeid for r in not_reported )
737
- return format_node_duration (sum (r .duration for r in not_reported ))
737
+ return format_node_duration (
738
+ sum (r .duration for r in not_reported if isinstance (r , TestReport ))
739
+ )
738
740
return ""
739
741
if collected :
740
742
return f" [{ len (self ._progress_nodeids_reported ) * 100 // collected :3d} %]"
Original file line number Diff line number Diff line change @@ -112,6 +112,31 @@ def test_func():
112
112
[" def test_func():" , "> assert 0" , "E assert 0" ]
113
113
)
114
114
115
+ def test_console_output_style_times_with_skipped_and_passed (
116
+ self , pytester : Pytester
117
+ ) -> None :
118
+ pytester .makepyfile (
119
+ test_repro = """
120
+ def test_hello():
121
+ pass
122
+ """ ,
123
+ test_repro_skip = """
124
+ import pytest
125
+ pytest.importorskip("fakepackage_does_not_exist")
126
+ """ ,
127
+ )
128
+ result = pytester .runpytest (
129
+ "test_repro.py" ,
130
+ "test_repro_skip.py" ,
131
+ "-o" ,
132
+ "console_output_style=times" ,
133
+ )
134
+
135
+ result .stdout .fnmatch_lines ("* 1 passed, 1 skipped in *" )
136
+
137
+ combined = "\n " .join (result .stdout .lines + result .stderr .lines )
138
+ assert "INTERNALERROR" not in combined
139
+
115
140
def test_internalerror (self , pytester : Pytester , linecomp ) -> None :
116
141
modcol = pytester .getmodulecol ("def test_one(): pass" )
117
142
rep = TerminalReporter (modcol .config , file = linecomp .stringio )
You can’t perform that action at this time.
0 commit comments