""" Pytest configuration and shared fixtures for Atomizer tests. """ import pytest import sys from pathlib import Path # Add project root to path sys.path.insert(0, str(Path(__file__).parent.parent)) def pytest_configure(config): """Register custom markers.""" config.addinivalue_line("markers", "nx: requires NX Open (skip with -m 'not nx')") config.addinivalue_line("markers", "slow: slow tests (skip with -m 'not slow')") def pytest_collection_modifyitems(config, items): """Auto-mark tests that import NXOpen.""" for item in items: # Auto-mark files with 'nx' or 'journal' in name if 'nx' in item.nodeid.lower() or 'journal' in item.nodeid.lower(): item.add_marker(pytest.mark.nx) @pytest.fixture def sample_study_dir(tmp_path): """Create a temporary study directory structure.""" study = tmp_path / "test_study" (study / "1_setup").mkdir(parents=True) (study / "2_iterations").mkdir() (study / "3_results").mkdir() return study @pytest.fixture def sample_config(): """Sample optimization config for testing.""" return { "study_name": "test_study", "design_variables": [ {"name": "param1", "lower": 0, "upper": 10, "type": "continuous"} ], "objectives": [ {"name": "minimize_mass", "direction": "minimize"} ] }