(pytester: Pytester)
| 1115 | |
| 1116 | |
| 1117 | def test_pass_output_reporting(pytester: Pytester) -> None: |
| 1118 | pytester.makepyfile( |
| 1119 | """ |
| 1120 | def setup_module(): |
| 1121 | print("setup_module") |
| 1122 | |
| 1123 | def teardown_module(): |
| 1124 | print("teardown_module") |
| 1125 | |
| 1126 | def test_pass_has_output(): |
| 1127 | print("Four score and seven years ago...") |
| 1128 | |
| 1129 | def test_pass_no_output(): |
| 1130 | pass |
| 1131 | """ |
| 1132 | ) |
| 1133 | result = pytester.runpytest() |
| 1134 | s = result.stdout.str() |
| 1135 | assert "test_pass_has_output" not in s |
| 1136 | assert "Four score and seven years ago..." not in s |
| 1137 | assert "test_pass_no_output" not in s |
| 1138 | result = pytester.runpytest("-rPp") |
| 1139 | result.stdout.fnmatch_lines( |
| 1140 | [ |
| 1141 | "*= PASSES =*", |
| 1142 | "*_ test_pass_has_output _*", |
| 1143 | "*- Captured stdout setup -*", |
| 1144 | "setup_module", |
| 1145 | "*- Captured stdout call -*", |
| 1146 | "Four score and seven years ago...", |
| 1147 | "*- Captured stdout teardown -*", |
| 1148 | "teardown_module", |
| 1149 | "*= short test summary info =*", |
| 1150 | "PASSED test_pass_output_reporting.py::test_pass_has_output", |
| 1151 | "PASSED test_pass_output_reporting.py::test_pass_no_output", |
| 1152 | "*= 2 passed in *", |
| 1153 | ] |
| 1154 | ) |
| 1155 | |
| 1156 | |
| 1157 | def test_color_yes(pytester: Pytester, color_mapping) -> None: |
nothing calls this directly
no test coverage detected