diff --git a/src/tests/test_crashing.py b/src/tests/test_crashing.py new file mode 100644 index 0000000000..acfbb97b61 --- /dev/null +++ b/src/tests/test_crashing.py @@ -0,0 +1,20 @@ +import os + +import pytest + + +@pytest.mark.skip +def test_crash(): + """ + This is a test that crashes with SIGKILL every (n+1)-th time it runs (n = 0, 1, 2, …). + This is useful for debugging our pytest-xdist monkeypatch that we apply in conftest.py + to deal with random test crashes on Travis CI using SQLite. Usually, this test is + skipped to avoid causing additional crashes in real runs. + """ + if os.path.exists('crashed.tmp'): + assert 1 + os.remove('crashed.tmp') + else: + with open('crashed.tmp', 'w') as f: + f.write('hi') + os.kill(os.getpid(), 9)