Skip to content

Commit

Permalink
chore: ensure sys.meta_path is properly reset after test is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
hxjo committed Jul 18, 2024
1 parent 60233cc commit aa8b5da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit aa8b5da

Please sign in to comment.