This is an automated email from the ASF dual-hosted git repository.
nchammas pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.x by this push:
new 93804468731b [SPARK-59857][BUILD] Ensure test module names are unique
93804468731b is described below
commit 93804468731ba8120f5adbabe44c8949aa8ff2d7
Author: Nicholas Chammas <[email protected]>
AuthorDate: Wed Sep 30 12:36:07 2026 +0300
[SPARK-59857][BUILD] Ensure test module names are unique
### What changes were proposed in this pull request?
Ensure that test module names are unique.
### Why are the changes needed?
Currently, nothing checks that this is the case. It's possible for someone
to accidentally reuse a name and cause weird problems with our test execution.
[SPARK-59180](https://issues.apache.org/jira/browse/SPARK-59180) will be
adding new test modules. This PR here will make that work a bit safer thanks to
the new check.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
New doctest.
### Was this patch authored or co-authored using generative AI tooling?
I wrote this with assistance from GitHub Copilot.
Closes #59132 from nchammas/test-module-name-uniqueness.
Authored-by: Nicholas Chammas <[email protected]>
Signed-off-by: Nicholas Chammas <[email protected]>
(cherry picked from commit 14141b9e262ccc61b5ba8b721874a288965c7b9a)
Signed-off-by: Nicholas Chammas <[email protected]>
---
dev/sparktestsupport/modules.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dev/sparktestsupport/modules.py b/dev/sparktestsupport/modules.py
index a2454f195bb2..ff921796e65d 100644
--- a/dev/sparktestsupport/modules.py
+++ b/dev/sparktestsupport/modules.py
@@ -129,6 +129,7 @@ class Module(object):
Define a new module.
:param name: A short module name, for display in logging and error
messages.
+ Must be unique across modules.
:param dependencies: A set of dependencies for this module. This
should only include direct
dependencies; transitive dependencies are resolved automatically.
:param source_file_regexes: a set of regexes that match source files
belonging to this
@@ -147,7 +148,17 @@ class Module(object):
is not explicitly changed.
:param should_run_r_tests: If true, changes in this module will
trigger all R tests.
:param should_run_build_tests: If true, changes in this module will
trigger build tests.
+
+ Duplicate names are rejected and not registered:
+
+ >>> Module("core", [], [])
+ Traceback (most recent call last):
+ ...
+ ValueError: module name 'core' is already in use
"""
+ if any(module.name == name for module in all_modules):
+ raise ValueError(f"module name {name!r} is already in use")
+
self.name = name
self.dependencies = dependencies
self.source_file_prefixes = source_file_regexes
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]