Skip to content

Introducing --track-filter option#5

Merged
NickDris merged 15 commits intomainfrom
introduce-track-filter
Sep 17, 2025
Merged

Introducing --track-filter option#5
NickDris merged 15 commits intomainfrom
introduce-track-filter

Conversation

@NickDris
Copy link
Contributor

@NickDris NickDris commented Sep 5, 2025

Introducing a --track-filter argument specified by a comma separated list of track names.
This defines a fixture meant for specific track inclusion, excluding any tracks you don't need to test.
Limiting the test coverage to specific tracks can dramatically decrease the test times of your track repository.

Introducing a --track-filter argument specified by a comma
separated list of track names. This defines a fixture meant for
specific track inclusion, excluding any tracks you don't need to
test.
Limiting the test coverage to specific tracks can dramatically
decrease the test times of your track repository.
@NickDris NickDris requested review from a team and Copilot September 5, 2025 10:01
Copy link

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 introduces a new --track-filter command-line option to allow filtering tests by specific track names, enabling users to run tests only for selected tracks to reduce test execution time.

  • Adds --track-filter CLI option that accepts comma-separated track names
  • Implements filtering logic in test generation to include only specified tracks
  • Creates a session-scoped fixture to access the track filter configuration

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pytest_rally/plugin.py Adds CLI option definition, parsing logic, and filtering implementation in test generation
pytest_rally/fixtures.py Adds session-scoped fixture to expose track filter configuration to tests

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

Copy link
Contributor

@gbanasiak gbanasiak left a comment

Choose a reason for hiding this comment

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

This looks good. I've refreshed tests in 1bed71d. Can you add a unit test that would capture --track-filter functionality?

@NickDris
Copy link
Contributor Author

NickDris commented Sep 5, 2025

This looks good. I've refreshed tests in 1bed71d. Can you add a unit test that would capture --track-filter functionality?

Done in latest commits

@NickDris NickDris requested a review from gbanasiak September 5, 2025 15:52
- Changes example fixture to dictionary
- The two unit tests for track-filter option now applies to both
autogenerated and marked tests
Copy link

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

Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.


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

Copy link
Contributor

@gbanasiak gbanasiak left a comment

Choose a reason for hiding this comment

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

I spent some time experimenting with this. I think we can avoid repetition of the code in conftest.py. It would also be nice to add test case for --skip-autogenerated-tests. Other comments are of lesser importance. Thank you for working on this, almost there :)

@NickDris NickDris requested a review from Copilot September 16, 2025 12:42
Copy link

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

Copilot reviewed 12 out of 13 changed files in this pull request and generated 2 comments.


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

@NickDris NickDris requested a review from gbanasiak September 16, 2025 12:48
Copy link
Contributor

@gbanasiak gbanasiak left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for iterating

@NickDris NickDris merged commit e58fa6b into main Sep 17, 2025
1 check passed
@NickDris NickDris deleted the introduce-track-filter branch September 17, 2025 07:33
@NickDris
Copy link
Contributor Author

NickDris commented Sep 17, 2025

Merged without the requested transformation for the following review comment:

in current form we verify only expected tracks run, but not if expected unit test methods based on the content of marked_tracks.py

and that's because some unit test methods runs multiple tracks and we cannot easily auto-discover their names. In the current form the check is asserting that pytest runs only the tracks with the same name as the markers in the track-filter.

To solve that I could be making raced_tracks an ordered list and produce the expected raced_tracks by handpicking tracks from the marked_tracks file in order, but that would make the function too large without an autodiscovery option, because the expected track list for each track-filter is different.

If you believe that this would be a better option, let's make another PR for it.

@gbanasiak
Copy link
Contributor

I think marked_tracks.py could simply be structured in such way that filtering for a given track produces a unique function name, and then the test could both check whether only the filtered track was run, and whether only the expected item does not have a skip marker added (in collection phase). We can tackle this some other time, if needed.

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.

3 participants