Improve performance and add type hints
This commit is contained in:
parent
1782db4840
commit
b7e10e766e
23 changed files with 745 additions and 178 deletions
25
conftest.py
Normal file
25
conftest.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from zeal import zeal_context
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Generator
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def use_zeal(request: pytest.FixtureRequest) -> Generator[None]:
|
||||
"""Enable Zeal N+1 detection context for each pytest test.
|
||||
|
||||
Use @pytest.mark.no_zeal for tests that intentionally exercise import paths
|
||||
where Zeal's strict get() heuristics are too noisy.
|
||||
|
||||
Yields:
|
||||
None: Control back to pytest for test execution.
|
||||
"""
|
||||
if request.node.get_closest_marker("no_zeal") is not None:
|
||||
yield
|
||||
return
|
||||
|
||||
with zeal_context():
|
||||
yield
|
||||
Loading…
Add table
Add a link
Reference in a new issue