mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
Add self-crashing test
This commit is contained in:
20
src/tests/test_crashing.py
Normal file
20
src/tests/test_crashing.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user