Fix CI errors: linting, type checking, and tests
- Fix import sorting in test_instruments.py (ruff I001) - Install pandas-stubs for mypy type checking - Add garbage collection cleanup to repository test fixtures - Prevent Windows file locking errors in tempfile cleanup All CI checks now passing: lint, type check, and all 244 tests.
This commit is contained in:
@@ -22,7 +22,13 @@ def temp_db():
|
||||
@pytest.fixture
|
||||
def repository(temp_db):
|
||||
"""Create a repository instance for testing."""
|
||||
return SQLiteRepository(temp_db)
|
||||
import gc
|
||||
repo = SQLiteRepository(temp_db)
|
||||
yield repo
|
||||
# Ensure all connections and file handles are closed before cleanup
|
||||
# This is critical on Windows to prevent PermissionError
|
||||
del repo
|
||||
gc.collect()
|
||||
|
||||
|
||||
def test_create_run(repository):
|
||||
@@ -235,6 +241,7 @@ def test_multiple_results(repository):
|
||||
|
||||
def test_custom_measurements_dir(temp_db):
|
||||
"""Test using a custom measurements directory."""
|
||||
import gc
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
measurements_dir = Path(tmpdir) / "custom_measurements"
|
||||
repo = SQLiteRepository(temp_db, measurements_dir=measurements_dir)
|
||||
@@ -254,6 +261,10 @@ def test_custom_measurements_dir(temp_db):
|
||||
expected_path = measurements_dir / f"run_{run_id}" / "measurements.parquet"
|
||||
assert expected_path.exists()
|
||||
|
||||
# Clean up repository before temp directory cleanup
|
||||
del repo
|
||||
gc.collect()
|
||||
|
||||
|
||||
def test_parquet_schema(repository):
|
||||
"""Test that Parquet file has correct schema."""
|
||||
|
||||
Reference in New Issue
Block a user