-
Notifications
You must be signed in to change notification settings - Fork 445
chore: parallelize testing in ci with xdist #3906
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
base: main
Are you sure you want to change the base?
Changes from all commits
af472fd
8070b8b
236c797
18e9493
32ac995
8e17a84
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,7 @@ inputs: | |||||
| pytest-args: | ||||||
| description: 'Additional arguments to pass to pytest' | ||||||
| required: false | ||||||
| default: '--mpl -W error::metpy.deprecation.MetpyDeprecationWarning' | ||||||
| default: '--mpl -W error::metpy.deprecation.MetpyDeprecationWarning -n auto --cov --cov-report=xml' | ||||||
| runs: | ||||||
| using: composite | ||||||
| steps: | ||||||
|
|
@@ -30,10 +30,8 @@ runs: | |||||
| # By running coverage in "parallel" mode and "combining", we can clean up the path names | ||||||
|
||||||
| # By running coverage in "parallel" mode and "combining", we can clean up the path names | |
| # Coverage is collected via pytest-cov as configured in the pytest-args input |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,5 +1,8 @@ | ||||
|
|
||||
|
||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,8 @@ test = [ | |
| "netCDF4", | ||
| "packaging>=21.0", | ||
| "pytest>=7.0", | ||
| "pytest-xdist", | ||
| "pytest-cov", | ||
|
Comment on lines
+61
to
+62
|
||
| "pytest-mpl", | ||
| "vcrpy>=4.3.1" | ||
| ] | ||
|
|
||
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 PR description mentions concerns about matplotlib not being thread-safe, which could make tests flaky with parallel execution. Consider adding pytest-xdist configuration to use 'loadscope' or 'loadfile' distribution mode instead of the default 'load' mode to reduce potential race conditions. This can be configured in pyproject.toml under [tool.pytest.ini_options] by adding 'addopts = "-n auto --dist=loadfile"' or similar. The '--dist=loadfile' mode ensures all tests in a file run on the same worker, which can help with matplotlib's thread safety issues.