""" Additional test configuration and helpers """ import asyncio import sys import os # Ensure the project root is in the Python path sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) def pytest_configure(config): """Configure pytest with custom markers""" config.addinivalue_line( "markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')" ) config.addinivalue_line( "markers", "integration: marks tests as integration tests" ) config.addinivalue_line( "markers", "unit: marks tests as unit tests" ) config.addinivalue_line( "markers", "network: marks tests that require network access" ) def pytest_collection_modifyitems(config, items): """Modify test collection to add markers automatically""" for item in items: # Mark async tests if asyncio.iscoroutinefunction(item.obj): item.add_marker("asyncio") # Mark tests in test_api.py as integration tests if "test_api.py" in str(item.fspath): item.add_marker("integration") # Mark other tests as unit tests else: item.add_marker("unit") # Pytest hooks def pytest_report_header(config): """Add custom header to pytest report""" return [ "Ohm Stream Downloader - Test Suite", f"Python: {sys.version}", ] def pytest_html_results_table_row(report, cells): """Customize HTML report (if pytest-html is installed)""" if report.passed: del cells[:]