[WIP] [for testing purposes] tests: run tests in parallel#14994
[WIP] [for testing purposes] tests: run tests in parallel#14994
Conversation
Summary of ChangesHello @parthea, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces modifications to the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enables parallel test execution using pytest-xdist, which is a great step towards speeding up the test suite. I've added two suggestions to improve the implementation:
- To ensure correct coverage reporting when running tests in parallel, the
--cov-appendflag should be added to thepytestcommand. - To provide more flexibility, especially for debugging, I've suggested making parallel execution an opt-in feature controlled by a command-line flag.
These changes should improve the robustness and usability of the parallel testing setup. Since the PR is marked as a work in progress, these suggestions should be helpful for finalization.
| "--cov-fail-under=0", | ||
| os.path.join("tests", "unit"), |
There was a problem hiding this comment.
When running tests in parallel with pytest-xdist and collecting coverage with pytest-cov, it's important to ensure coverage data from all worker processes is combined correctly. Without this, you might get inaccurate coverage reports because worker processes can overwrite each other's data.
Please add the --cov-append flag to the pytest command. This will ensure that coverage data from each test run is appended to the .coverage file, rather than overwriting it.
"--cov-fail-under=0",
"--cov-append",
os.path.join("tests", "unit"),There was a problem hiding this comment.
| if protobuf_implementation == "cpp": | ||
| session.install("protobuf<4") | ||
|
|
||
| concurrent_args = ["-n", "auto"] |
There was a problem hiding this comment.
Hardcoding parallel execution might not always be desirable, for example when debugging. It's better to make it an opt-in feature. You can control this with a command-line flag passed to nox, like --parallel. This way, developers can run tests in parallel by executing nox -s unit -- --parallel.
concurrent_args = []
if "--parallel" in session.posargs:
session.posargs.remove("--parallel")
concurrent_args = ["-n", "auto"]There was a problem hiding this comment.
We always want to run tests in parallel because it's faster rather than having it as an opt-in.
9ee5b32 to
920ed09
Compare
9230f12 to
c831137
Compare
Towards #14992