From aa8b5da00024702e90f82c40676a1bb923b49cc6 Mon Sep 17 00:00:00 2001 From: Hugo Mortreux <70602545+hxjo@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:47:57 +0200 Subject: [PATCH] chore: ensure sys.meta_path is properly reset after test is closed --- .github/workflows/test.yml | 2 +- .../test_deprecation_ssr_requests.py | 6 ++---- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6552f22..15f4aca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -23,4 +23,4 @@ jobs: - name: Install dependencies run: poetry install --no-ansi --no-interaction - name: Run tests - run: pytest --cov-config=.coveragerc --cov=inertia --cov-report=term-missing --cov-fail-under=90 inertia/tests + run: pytest --cov-config=.coveragerc --cov=inertia --cov-report=term-missing --cov-fail-under=98 inertia/tests diff --git a/inertia/tests/test_backward_compatibility/test_deprecation_ssr_requests.py b/inertia/tests/test_backward_compatibility/test_deprecation_ssr_requests.py index acaaeea..9014a9b 100644 --- a/inertia/tests/test_backward_compatibility/test_deprecation_ssr_requests.py +++ b/inertia/tests/test_backward_compatibility/test_deprecation_ssr_requests.py @@ -56,8 +56,7 @@ def fail_httpx_import_module_not_found() -> Generator[None, None, None]: yield - # Reset sys.meta_path and sys.modules after the test - # sys.meta_path.remove(import_raiser) + sys.meta_path.remove(import_raiser) if "httpx" not in sys.modules and original_httpx is not None: sys.modules["httpx"] = original_httpx @@ -82,8 +81,7 @@ def fail_httpx_import() -> Generator[None, None, None]: yield - # Reset sys.meta_path and sys.modules after the test - # sys.meta_path.remove(import_raiser) + sys.meta_path.remove(import_raiser) if "httpx" not in sys.modules and original_httpx is not None: sys.modules["httpx"] = original_httpx diff --git a/pyproject.toml b/pyproject.toml index 167a05e..55694d7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,7 +50,7 @@ check_untyped_defs = true [tool.poe.tasks] -test = "pytest inertia/tests --cov inertia --cov-report term-missing" +test = "pytest inertia/tests --cov inertia --cov-report term-missing --cov-fail-under=98" type_check = "mypy inertia" format = "ruff format inertia" lint = "ruff check inertia --fix"