[SPARK-54450][INFRA][FOLLOWUP] Support unittest style string in run-tests #53465
+57
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This is a followup for reverted SPARK-54450. We still want this feature, it's useful, we just don't want to interrupt people's workflow.
We are more careful about detecting test modules. If we fail to import a module that is not the test module itself (e.g.
py4j), we just pass the whole string and hope it works.Why are the changes needed?
If the user is using a weird python to start the script, they might not have the full environment set up. However,
bin/pysparkstill works because it has its own environment manipulation mechanism. So unable to import the test module inrun-tests.pydoes not necessarily mean we can't run the test.We want to keep a better backward compatibility while introducing the new convenient features.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Manually confirmed the warning is generated and the test will still work if
py4jis not available.Was this patch authored or co-authored using generative AI tooling?
No