-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pytest_collection_modifyitems to select benchmark tests only #1874
Fix pytest_collection_modifyitems to select benchmark tests only #1874
Conversation
: Signed-off-by: Achal Shah <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #1874 +/- ##
===========================================
- Coverage 84.58% 62.37% -22.22%
===========================================
Files 93 93
Lines 7273 7282 +9
===========================================
- Hits 6152 4542 -1610
- Misses 1121 2740 +1619
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
if not should_run_integration: | ||
for t in integration_tests: | ||
items.remove(t) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like these are exclusive?
If the user does should_run_integration and should_run_benchmark, it ends up only running benchmark tests.
I'd expect this more to be
if not should_run_integration, remove integration tests
if not should_run_benchmarks, remove benchmarks
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the current behaviour to be exclusive.
if user specifies --benchmark
and --integration
, it runs tests marked with both. If the user specified only one of them, it runs tests with only those marks.
i prefer this behaviour since otherwise we run unit tests during all our integration tests - which seems like a duplication and a waste. It also is more straightforward to reason about, IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why integration
and benchmark
tests are orthogonal is because it's possible for an integration test to need access to resources on aws/gcp, which requires the integration
mark so that it can be set up correctly.
Signed-off-by: Achal Shah <[email protected]>
8886373
to
582087d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: achals, felixwang9817 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Achal Shah [email protected]
What this PR does / why we need it:
Fixes a bug. Additionally, remove test items instead of skipping them. This makes
--collect-only
more useful, since that flag doesn't filter out skipped flags.Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: