|
30 | 30 | ROOT_DIR = os.path.abspath(os.path.normpath(ROOT_DIR)) |
31 | 31 | LOG_PREFIX = r'[0-9]+:[0-9]+:[0-9]+ (?:load avg: [0-9]+\.[0-9]{2} )?' |
32 | 32 |
|
33 | | -EXITCODE_BAD_TEST = 2 |
34 | | -EXITCODE_ENV_CHANGED = 3 |
35 | | -EXITCODE_NO_TESTS_RAN = 4 |
36 | | -EXITCODE_INTERRUPTED = 130 |
37 | | - |
38 | 33 | TEST_INTERRUPTED = textwrap.dedent(""" |
39 | 34 | from signal import SIGINT, raise_signal |
40 | 35 | try: |
@@ -1120,160 +1115,6 @@ def test_fail_once(self): |
1120 | 1115 | self.check_executed_tests(output, [testname], |
1121 | 1116 | rerun={testname: "test_fail_once"}) |
1122 | 1117 |
|
1123 | | - def test_rerun_setup_class_hook_failure(self): |
1124 | | - # FAILURE then FAILURE |
1125 | | - code = textwrap.dedent(""" |
1126 | | - import unittest |
1127 | | -
|
1128 | | - class ExampleTests(unittest.TestCase): |
1129 | | - @classmethod |
1130 | | - def setUpClass(self): |
1131 | | - raise RuntimeError('Fail') |
1132 | | -
|
1133 | | - def test_success(self): |
1134 | | - return |
1135 | | - """) |
1136 | | - testname = self.create_test(code=code) |
1137 | | - |
1138 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1139 | | - self.check_executed_tests(output, testname, |
1140 | | - failed=[testname], |
1141 | | - rerun={testname: "ExampleTests"}) |
1142 | | - |
1143 | | - def test_rerun_teardown_class_hook_failure(self): |
1144 | | - # FAILURE then FAILURE |
1145 | | - code = textwrap.dedent(""" |
1146 | | - import unittest |
1147 | | -
|
1148 | | - class ExampleTests(unittest.TestCase): |
1149 | | - @classmethod |
1150 | | - def tearDownClass(self): |
1151 | | - raise RuntimeError('Fail') |
1152 | | -
|
1153 | | - def test_success(self): |
1154 | | - return |
1155 | | - """) |
1156 | | - testname = self.create_test(code=code) |
1157 | | - |
1158 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1159 | | - self.check_executed_tests(output, testname, |
1160 | | - failed=[testname], |
1161 | | - rerun={testname: "ExampleTests"}) |
1162 | | - |
1163 | | - def test_rerun_setup_module_hook_failure(self): |
1164 | | - # FAILURE then FAILURE |
1165 | | - code = textwrap.dedent(""" |
1166 | | - import unittest |
1167 | | -
|
1168 | | - def setUpModule(): |
1169 | | - raise RuntimeError('Fail') |
1170 | | -
|
1171 | | - class ExampleTests(unittest.TestCase): |
1172 | | - def test_success(self): |
1173 | | - return |
1174 | | - """) |
1175 | | - testname = self.create_test(code=code) |
1176 | | - |
1177 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1178 | | - self.check_executed_tests(output, testname, |
1179 | | - failed=[testname], |
1180 | | - rerun={testname: testname}) |
1181 | | - |
1182 | | - def test_rerun_teardown_module_hook_failure(self): |
1183 | | - # FAILURE then FAILURE |
1184 | | - code = textwrap.dedent(""" |
1185 | | - import unittest |
1186 | | -
|
1187 | | - def tearDownModule(): |
1188 | | - raise RuntimeError('Fail') |
1189 | | -
|
1190 | | - class ExampleTests(unittest.TestCase): |
1191 | | - def test_success(self): |
1192 | | - return |
1193 | | - """) |
1194 | | - testname = self.create_test(code=code) |
1195 | | - |
1196 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1197 | | - self.check_executed_tests(output, testname, |
1198 | | - failed=[testname], |
1199 | | - rerun={testname: testname}) |
1200 | | - |
1201 | | - def test_rerun_setup_hook_failure(self): |
1202 | | - # FAILURE then FAILURE |
1203 | | - code = textwrap.dedent(""" |
1204 | | - import unittest |
1205 | | -
|
1206 | | - class ExampleTests(unittest.TestCase): |
1207 | | - def setUp(self): |
1208 | | - raise RuntimeError('Fail') |
1209 | | -
|
1210 | | - def test_success(self): |
1211 | | - return |
1212 | | - """) |
1213 | | - testname = self.create_test(code=code) |
1214 | | - |
1215 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1216 | | - self.check_executed_tests(output, testname, |
1217 | | - failed=[testname], |
1218 | | - rerun={testname: "test_success"}) |
1219 | | - |
1220 | | - def test_rerun_teardown_hook_failure(self): |
1221 | | - # FAILURE then FAILURE |
1222 | | - code = textwrap.dedent(""" |
1223 | | - import unittest |
1224 | | -
|
1225 | | - class ExampleTests(unittest.TestCase): |
1226 | | - def tearDown(self): |
1227 | | - raise RuntimeError('Fail') |
1228 | | -
|
1229 | | - def test_success(self): |
1230 | | - return |
1231 | | - """) |
1232 | | - testname = self.create_test(code=code) |
1233 | | - |
1234 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1235 | | - self.check_executed_tests(output, testname, |
1236 | | - failed=[testname], |
1237 | | - rerun={testname: "test_success"}) |
1238 | | - |
1239 | | - def test_rerun_async_setup_hook_failure(self): |
1240 | | - # FAILURE then FAILURE |
1241 | | - code = textwrap.dedent(""" |
1242 | | - import unittest |
1243 | | -
|
1244 | | - class ExampleTests(unittest.IsolatedAsyncioTestCase): |
1245 | | - async def asyncSetUp(self): |
1246 | | - raise RuntimeError('Fail') |
1247 | | -
|
1248 | | - async def test_success(self): |
1249 | | - return |
1250 | | - """) |
1251 | | - testname = self.create_test(code=code) |
1252 | | - |
1253 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1254 | | - self.check_executed_tests(output, testname, |
1255 | | - failed=[testname], |
1256 | | - rerun={testname: "test_success"}) |
1257 | | - |
1258 | | - def test_rerun_async_teardown_hook_failure(self): |
1259 | | - # FAILURE then FAILURE |
1260 | | - code = textwrap.dedent(""" |
1261 | | - import unittest |
1262 | | -
|
1263 | | - class ExampleTests(unittest.IsolatedAsyncioTestCase): |
1264 | | - async def asyncTearDown(self): |
1265 | | - raise RuntimeError('Fail') |
1266 | | -
|
1267 | | - async def test_success(self): |
1268 | | - return |
1269 | | - """) |
1270 | | - testname = self.create_test(code=code) |
1271 | | - |
1272 | | - output = self.run_tests("-w", testname, exitcode=EXITCODE_BAD_TEST) |
1273 | | - self.check_executed_tests(output, testname, |
1274 | | - failed=[testname], |
1275 | | - rerun={testname: "test_success"}) |
1276 | | - |
1277 | 1118 | def test_no_tests_ran(self): |
1278 | 1119 | code = textwrap.dedent(""" |
1279 | 1120 | import unittest |
|
0 commit comments