Skip to content

Decrease the number of tests for RateDetection#423

Merged
psomhorst merged 3 commits intodevelopfrom
fix/decrease_num_ratedetection_tests
Aug 25, 2025
Merged

Decrease the number of tests for RateDetection#423
psomhorst merged 3 commits intodevelopfrom
fix/decrease_num_ratedetection_tests

Conversation

@psomhorst
Copy link
Copy Markdown
Contributor

@psomhorst psomhorst commented Aug 25, 2025

RateDetection tests are slow. This PR marks them as slow and makes it they don't by default, e.g., with each push to a PR branch. However, before release, all slow tests are run in all versions of Python.

@psomhorst psomhorst requested a review from Copilot August 25, 2025 14:44

This comment was marked as outdated.

@psomhorst psomhorst changed the base branch from main to develop August 25, 2025 14:44
@psomhorst psomhorst requested a review from Copilot August 25, 2025 14:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the test suite by marking slow RateDetection tests with a @pytest.mark.slow decorator and configuring pytest to skip these tests by default, while ensuring they still run during release workflows.

Key changes:

  • Added pytest configuration to handle slow test markers and skip them by default
  • Marked four parameterized RateDetection test functions as slow
  • Updated the release workflow to explicitly run slow tests with the --runslow flag

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_rate_detection.py Added @pytest.mark.slow decorators to four parameterized test functions
tests/conftest.py Added pytest configuration for handling slow test markers and skipping logic
.github/workflows/release_github.yml Updated pytest command to include --runslow flag for release testing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +25 to +33
def pytest_addoption(parser: pytest.Parser):
parser.addoption("--runslow", action="store_true", default=False, help="run tests marked as slow")


def pytest_configure(config: pytest.Config):
config.addinivalue_line("markers", "slow: mark test as slow to run")


def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pytest hook functions lack docstrings explaining their purpose and behavior. Consider adding docstrings to document what each hook does, especially the collection modification logic.

Suggested change
def pytest_addoption(parser: pytest.Parser):
parser.addoption("--runslow", action="store_true", default=False, help="run tests marked as slow")
def pytest_configure(config: pytest.Config):
config.addinivalue_line("markers", "slow: mark test as slow to run")
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
def pytest_addoption(parser: pytest.Parser):
"""Add a command-line option '--runslow' to enable running tests marked as slow."""
parser.addoption("--runslow", action="store_true", default=False, help="run tests marked as slow")
def pytest_configure(config: pytest.Config):
"""Register the 'slow' marker for tests."""
config.addinivalue_line("markers", "slow: mark test as slow to run")
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]):
"""
Skip tests marked as 'slow' unless the '--runslow' option is specified.
This hook checks for the presence of the '--runslow' command-line option.
If it is not set, all tests marked with 'slow' are skipped.
"""

Copilot uses AI. Check for mistakes.
@psomhorst psomhorst merged commit ea995f6 into develop Aug 25, 2025
3 checks passed
@psomhorst psomhorst deleted the fix/decrease_num_ratedetection_tests branch August 25, 2025 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants