Skip to content

Parametrize acceptance action with pytest parallel worker count#730

Open
mwojtyczka wants to merge 7 commits intomainfrom
param_parallel_runs
Open

Parametrize acceptance action with pytest parallel worker count#730
mwojtyczka wants to merge 7 commits intomainfrom
param_parallel_runs

Conversation

@mwojtyczka
Copy link
Copy Markdown
Contributor

@mwojtyczka mwojtyczka commented Apr 21, 2026

Summary

  • Add a new n input to the acceptance GitHub Action (default 10) for configuring pytest-xdist parallel workers. Propagates via the PYTEST_N env var to pytest_run.py; Go tests are unaffected.
  • Updated depreciated sdk methods to fix make fmt

Test plan

  • make fmt passes locally
  • make test passes locally
  • Run the action in a downstream repo with n: '4' and confirm pytest uses -n 4
  • Run the action without setting n and confirm default of 10

Context: we need to be able to reduce parallel test execution in DQX as 10 parallel runs creates a high contention of testing clusters. This would require a new release.

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

Adds configurability for pytest-xdist parallelism in the acceptance GitHub Action and reduces staticcheck noise from a tracked deprecation migration.

Changes:

  • Introduce a new n action input (default 10) and propagate it via PYTEST_N into the acceptance test runtime.
  • Update pytest_run.py to read the worker count from PYTEST_N instead of hard-coding -n 10.
  • Add an acceptance/staticcheck.conf to suppress SA1019 warnings during make fmt until a separate migration completes.

Reviewed changes

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

File Description
acceptance/action.yml Adds the new n input with default 10.
acceptance/main.go Forwards the n input into the action’s environment as PYTEST_N.
acceptance/ecosystem/pytest_run.py Uses PYTEST_N to set pytest-xdist -n.
acceptance/staticcheck.conf Globally disables SA1019 for the acceptance module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread acceptance/action.yml
Comment on lines +30 to +33
n:
description: 'Number of parallel pytest workers (pytest-xdist -n).'
required: false
default: '10'
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

The action is implemented via shim.js, which currently pins the downloaded binary version (e.g., acceptance/shim.js:1 is v0.4.4). Adding the new n input here will have no effect for anyone running the action from this branch/commit until the shim version is bumped to a release that includes the updated Go binary; otherwise the action advertises n but the downloaded binary ignores it. Consider updating shim.js in the same change set (and cutting the corresponding acceptance/vX.Y.Z release), or defer exposing the input until the release commit so the action definition and runtime stay in sync.

Suggested change
n:
description: 'Number of parallel pytest workers (pytest-xdist -n).'
required: false
default: '10'

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@mwojtyczka mwojtyczka Apr 21, 2026

Choose a reason for hiding this comment

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

The release PR after merge should handle the shim bump, same as the repo has done historically. However, new release cut is necessary

Comment thread acceptance/main.go
Comment thread acceptance/ecosystem/pytest_run.py Outdated
if __name__ == '__main__':
sys.exit(pytest.main([
'-n', '10',
'-n', os.environ.get('PYTEST_N', '10'),
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

os.environ.get('PYTEST_N', '10') will return an empty string if PYTEST_N is present-but-empty, which results in passing -n '' to pytest-xdist (a hard failure). Consider treating empty/whitespace values as unset (e.g., fallback to 10 after .strip()), or validate and fail with a clear message.

Suggested change
'-n', os.environ.get('PYTEST_N', '10'),
'-n', (os.environ.get('PYTEST_N') or '').strip() or '10',

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated

Comment thread acceptance/main.go
Comment on lines +74 to +76
if n := a.Action.GetInput("n"); n != "" {
ctx = env.Set(ctx, "PYTEST_N", n)
}
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

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

This change introduces new behavior (propagating the n action input into the test environment) but there’s no unit/integration coverage asserting the input-to-env wiring. Given the existing Go test suite in this module, consider adding a targeted test around the env injection (or factoring it into a helper that can be unit-tested) to prevent regressions.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

@mwojtyczka mwojtyczka Apr 21, 2026

Choose a reason for hiding this comment

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

i can add unit tests, but this will require much bigger changes as the existing code is not readily testable. This has historically be manually tested. Let me know how to proceed. Happy to add unit tests but this will require refactor of the existing code to make it testable

Addresses PR #730 review:
- Trim + validate `n` in main.go as positive integer or "auto", returning
  a clear error for invalid values instead of letting pytest-xdist fail
  with an opaque CLI error.
- Treat an empty/whitespace PYTEST_N env var as unset in pytest_run.py so
  `-n ''` is never passed to pytest.

Co-authored-by: Isaac
pytest_run.py already strips and defaults PYTEST_N, and pytest-xdist
surfaces clear CLI errors for non-integer values. Remove the Go-side
validation so the action is a simple pass-through — this also keeps
`n: 'auto'` working as a pytest-xdist native mode.

Co-authored-by: Isaac
Exercises the n → PYTEST_N wiring when the skipped integration test is
run manually with real credentials.

Co-authored-by: Isaac
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