Modify test collection to add markers automatically.
(config, items)
| 30 | sys.modules[module] = Mock() |
| 31 | |
| 32 | def pytest_collection_modifyitems(config, items): |
| 33 | """Modify test collection to add markers automatically.""" |
| 34 | for item in items: |
| 35 | # Add unit marker to test_options_parsing and test_helpers |
| 36 | if "test_options_parsing" in item.nodeid or "test_helpers" in item.nodeid: |
| 37 | item.add_marker(pytest.mark.unit) |
| 38 | |
| 39 | # Add integration marker to integration tests |
| 40 | if "test_tools_integration" in item.nodeid: |
| 41 | item.add_marker(pytest.mark.integration) |
| 42 | |
| 43 | # Mark network tests |
| 44 | if "network" in item.name.lower(): |
| 45 | item.add_marker(pytest.mark.network) |
| 46 | |
| 47 | # Mark slow tests |
| 48 | if any(keyword in item.name.lower() for keyword in ["slow", "timeout", "long"]): |
| 49 | item.add_marker(pytest.mark.slow) |
| 50 | |
| 51 | @pytest.fixture(scope="session") |
| 52 | def mock_msf_environment(): |
nothing calls this directly
no outgoing calls
no test coverage detected