High-level description
This file,conftest.py, is a pytest configuration file that sets up custom options and behaviors for running tests. It specifically introduces a mechanism to mark and optionally skip slow tests, allowing for more efficient test execution in different scenarios.
Symbols
pytest_addoption
Description
This function adds a custom command-line option--runslow to pytest.
Inputs
Internal Logic
The function adds a boolean option--runslow to the pytest command-line interface. When used, this option allows slow tests to run.
pytest_configure
Description
This function adds a custom markerslow to pytest’s configuration.
Inputs
Internal Logic
The function adds a new line to pytest’s ini-file configuration, defining aslow marker that can be used to identify slow tests.
pytest_collection_modifyitems
Description
This function modifies the collected test items based on whether the--runslow option is provided.
Inputs
Internal Logic
- Checks if the
--runslowoption is provided. - If not provided, it creates a
skip_slowmarker. - Iterates through all test items and adds the
skip_slowmarker to any test marked as “slow”.
Dependencies
Configuration
API/Interface Reference
This configuration file extends pytest’s functionality by introducing a way to mark tests as slow and optionally skip them during test execution. It provides a command-line option
--runslow that, when not specified, will cause all tests marked as “slow” to be skipped. This allows for faster test runs in scenarios where running slow tests is not necessary or desired, while still maintaining the ability to run all tests when needed.