pytest-integration-mark
raw JSON → 0.2.0 verified Fri May 01 auth: no python
A pytest plugin that automatically marks tests with 'integration' based on custom markers and provides options to exclude, include, or run only integration tests. Current version: 0.2.0. Maintained by Barbora Data Science.
pip install pytest-integration-mark Common errors
error ModuleNotFoundError: No module named 'pytest_integration_mark' ↓
cause The plugin is not an importable module; it's a pytest plugin loaded via entry points. No direct import exists.
fix
Ensure pytest and pytest-integration-mark are installed: pip install pytest pytest-integration-mark
error WARNING: Ignored the following markers in the test file: integration ↓
cause pytest may ignore custom markers if they are not registered; the plugin registers the marker automatically, but this warning appears if the marker is used before loading the plugin.
fix
Ensure the plugin is installed and listed in pytest's plugins or installed as a package. Run pytest with -p pytest_integration_mark to force loading.
Warnings
gotcha The plugin automatically treats any test with a marker named 'integration' (including custom markers like @pytest.mark.integration) as an integration test. Ensure you don't have unrelated markers named 'integration' that might be picked up unintentionally. ↓
fix Use unique marker names for different purposes, or configure the plugin to ignore certain markers.
gotcha If you use @pytest.mark.integration with parameters, the marker must be directly on the test function, not on a class or module level, for the plugin to recognize it. ↓
fix Apply the marker directly to each test function, or use pytest.mark.parametrize with the marker separately.
deprecated The plugin is very stable and no deprecations are known for version 0.2.0. ↓
fix None
Imports
- pytest_configure wrong
from pytest_integration_mark import ...correctdef pytest_configure(config): ...
Quickstart
# In conftest.py or test file
import pytest
# Mark a test as integration
@pytest.mark.integration
def test_my_integration():
assert True
# Run only integration tests: pytest -m integration
# Exclude integration tests: pytest --no-integration
# Only integration tests: pytest --only-integration