chore: update development dependencies and improve test coverage
Some checks failed
CI / lint-and-test (push) Failing after 11s
Some checks failed
CI / lint-and-test (push) Failing after 11s
- 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.
This commit is contained in:
22
tests/conftest.py
Normal file
22
tests/conftest.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user