nchammas commented on code in PR #59250:
URL: https://github.com/apache/spark/pull/59250#discussion_r4375963656


##########
dev/sparktestsupport/modules.py:
##########
@@ -102,6 +105,58 @@ def is_ignored_file(filename: str) -> bool:
     return False
 
 
+class TestStage(Enum):
+    """
+    When a shell script test goal runs in dev/run-tests.py.
+    """
+
+    # Before the Spark build.
+    PRE_BUILD = "pre_build"
+
+
+@dataclass(frozen=True)
+class ShellScriptTestGoal:
+    """
+    Describe a shell script test goal.
+
+    >>> goal = ShellScriptTestGoal("dev/example")
+    >>> goal.stage.value
+    'pre_build'
+
+    A plain-string stage would silently never match, so it is rejected:
+
+    >>> ShellScriptTestGoal("dev/example", "post_build")
+    Traceback (most recent call last):
+        ...
+    TypeError: Unsupported test stage: 'post_build'
+
+    The path may be a `str` or `Path`, and is normalized:
+
+    >>> ShellScriptTestGoal(Path("./dev//example")) == 
ShellScriptTestGoal("dev/example")
+    True
+
+    The path is a repository-relative script:
+
+    >>> ShellScriptTestGoal("/tmp/example")
+    Traceback (most recent call last):
+        ...
+    ValueError: Shell script path must be relative to repo root: '/tmp/example'
+    """
+
+    path: str | Path

Review Comment:
   I like normalizing to `Path` but accepting `str` or `Path`, as that allows 
for caller flexibility while (hopefully) addressing the concerns you detailed 
here and in other comments.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to