Skip to content

Commit

Permalink
test(fix): isolate excepthook tests from each other
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Nov 2, 2021
1 parent f2d4073 commit 7ce5148
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/test_execfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import pathlib
import py_compile
import re
import sys

import pytest

Expand All @@ -26,6 +27,12 @@
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())
Expand Down
2 changes: 2 additions & 0 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,8 @@ def test_bug_909(self):
class ExcepthookTest(CoverageTest):
"""Tests of sys.excepthook support."""

# TODO: do we need these as process tests if we have test_execfile.py:RunFileTest?

def test_excepthook(self):
self.make_file("excepthook.py", """\
import sys
Expand Down

0 comments on commit 7ce5148

Please sign in to comment.