summaryrefslogtreecommitdiff
path: root/tests/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-02 07:50:51 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-11-02 08:12:51 -0400
commit87987b1237a85001965385875b3eaddb02da43be (patch)
treef38569df1e8af8195dba6c44ade454ac737b67ee /tests/test_execfile.py
parent8a3bf9edc919e87605a8079aa11a3494f562a9b0 (diff)
downloadpython-coveragepy-git-87987b1237a85001965385875b3eaddb02da43be.tar.gz
test(fix): isolate excepthook tests from each other
Diffstat (limited to 'tests/test_execfile.py')
-rw-r--r--tests/test_execfile.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_execfile.py b/tests/test_execfile.py
index 21cbb727..b7a09902 100644
--- a/tests/test_execfile.py
+++ b/tests/test_execfile.py
@@ -10,6 +10,7 @@ import os.path
import pathlib
import py_compile
import re
+import sys
import pytest
@@ -26,6 +27,12 @@ TRY_EXECFILE = os.path.join(TESTS_DIR, "modules/process_test/try_execfile.py")
class RunFileTest(CoverageTest):
"""Test cases for `run_python_file`."""
+ @pytest.fixture(autouse=True)
+ def clean_up(self):
+ """These tests all run in-process. Clean up global changes."""
+ yield
+ sys.excepthook = sys.__excepthook__
+
def test_run_python_file(self):
run_python_file([TRY_EXECFILE, "arg1", "arg2"])
mod_globs = json.loads(self.stdout())