Files
duty-teller/tests/conftest.py
Nikolay Tatarinov e25eb7be2f
Some checks failed
CI / lint-and-test (push) Failing after 11s
chore: update development dependencies and improve test coverage
- Upgraded `pytest-asyncio` to version 1.0 to ensure compatibility with the latest features and improvements.
- Increased the coverage threshold in pytest configuration to 80%, enhancing the quality assurance process.
- Added a new `conftest.py` file to manage shared fixtures and improve test organization.
- Introduced multiple new test files to cover various components, ensuring comprehensive test coverage across the application.
- Updated the `.coverage` file to reflect the latest coverage metrics.
2026-02-20 17:33:04 +03:00

23 lines
638 B
Python

"""Pytest configuration and shared fixtures.
Disposes the global DB engine after each test to avoid ResourceWarning
from unclosed sqlite3 connections when tests touch duty_teller.db.session.
"""
import pytest
@pytest.fixture(autouse=True)
def _dispose_db_engine_after_test():
"""After each test, dispose the global engine so connections are closed."""
yield
try:
import duty_teller.db.session as session_mod
if session_mod._engine is not None:
session_mod._engine.dispose()
session_mod._engine = None
session_mod._SessionLocal = None
except Exception:
pass