import pytest
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
"""
|
||||
Pytest configuration and shared fixtures.
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def project_root():
|
||||
"""Return the project root directory."""
|
||||
return Path(__file__).parent.parent
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def test_data_dir(project_root):
|
||||
"""Return the test data directory."""
|
||||
return project_root / "test_case"
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def expected_results_dir(project_root):
|
||||
"""Return the expected results directory."""
|
||||
return project_root / "test_res"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def temp_test_dir(tmp_path):
|
||||
"""Create a temporary directory for test output."""
|
||||
test_dir = tmp_path / "test_output"
|
||||
test_dir.mkdir(exist_ok=True)
|
||||
yield test_dir
|
||||
# Cleanup after test (optional)
|
||||
# shutil.rmtree(test_dir, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_test_state():
|
||||
"""Reset any global state before each test."""
|
||||
# Add any necessary cleanup here
|
||||
yield
|
||||
# Post-test cleanup
|
||||
Reference in New Issue
Block a user