| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
import unittest |
| 8 |
import glob |
| 9 |
import os.path |
| 10 |
import test.support |
| 11 |
from test.support.script_helper import assert_python_failure |
| 12 |
|
| 13 |
CRASHER_DIR = os.path.join(os.path.dirname(__file__), "crashers") |
| 14 |
CRASHER_FILES = os.path.join(glob.escape(CRASHER_DIR), "*.py") |
| 15 |
|
| 16 |
infinite_loops = ["infinite_loop_re.py", "nasty_eq_vs_dict.py"] |
| 17 |
|
| 18 |
class CrasherTest(unittest.TestCase): |
| 19 |
|
| 20 |
@unittest.skip("these tests are too fragile") |
| 21 |
@test.support.cpython_only |
| 22 |
def test_crashers_crash(self): |
| 23 |
for fname in glob.glob(CRASHER_FILES): |
| 24 |
if os.path.basename(fname) in infinite_loops: |
| 25 |
continue |
| 26 |
|
| 27 |
|
| 28 |
if test.support.verbose: |
| 29 |
print("Checking crasher:", fname) |
| 30 |
assert_python_failure(fname) |
| 31 |
|
| 32 |
|
| 33 |
def tearDownModule(): |
| 34 |
test.support.reap_children() |
| 35 |
|
| 36 |
if __name__ == "__main__": |
| 37 |
unittest.main() |