Skip to content

Commit 87987b1

Browse files
committed
test(fix): isolate excepthook tests from each other
1 parent 8a3bf9e commit 87987b1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tests/test_execfile.py

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import pathlib
1111
import py_compile
1212
import re
13+
import sys
1314

1415
import pytest
1516

@@ -26,6 +27,12 @@
2627
class RunFileTest(CoverageTest):
2728
"""Test cases for `run_python_file`."""
2829

30+
@pytest.fixture(autouse=True)
31+
def clean_up(self):
32+
"""These tests all run in-process. Clean up global changes."""
33+
yield
34+
sys.excepthook = sys.__excepthook__
35+
2936
def test_run_python_file(self):
3037
run_python_file([TRY_EXECFILE, "arg1", "arg2"])
3138
mod_globs = json.loads(self.stdout())

tests/test_process.py

+2
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,8 @@ def test_bug_909(self):
10921092
class ExcepthookTest(CoverageTest):
10931093
"""Tests of sys.excepthook support."""
10941094

1095+
# TODO: do we need these as process tests if we have test_execfile.py:RunFileTest?
1096+
10951097
def test_excepthook(self):
10961098
self.make_file("excepthook.py", """\
10971099
import sys

0 commit comments

Comments
 (0)