From 975c2ef1d860cee17e5c8bc93ac77f86d17153f3 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Sat, 25 Nov 2023 15:56:45 +1100 Subject: [PATCH] Fix an import error --- pytest_subinterpreter/plugin.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pytest_subinterpreter/plugin.py b/pytest_subinterpreter/plugin.py index f49b3b0..529d08e 100644 --- a/pytest_subinterpreter/plugin.py +++ b/pytest_subinterpreter/plugin.py @@ -14,7 +14,6 @@ def pytest_addoption(parser): def wrap_pytest(): # args: tuple[str], plugins: tuple[str] import sys - from pytest_subinterpreter.faulthandler import FaultHandler from _pytest.main import wrap_session, _main from _pytest.config import get_config @@ -23,6 +22,8 @@ def wrap_pytest(): config.parse(list(args)) # The CPython faulthandler isn't supported, patch it with a dummy. + # Pytest requires that you import the module after importing pytest things. + from pytest_subinterpreter.faulthandler import FaultHandler sys.modules["faulthandler"] = FaultHandler() wrap_session(config, _main) diff --git a/setup.py b/setup.py index 4968a56..871cfa7 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="pytest-subinterpreter", - version="0.0.1", + version="0.0.2", description="Run pytest in a subinterpreter", long_description=long_description, packages=["pytest_subinterpreter"],