Yikun commented on a change in pull request #32867:
URL: https://github.com/apache/spark/pull/32867#discussion_r652400691
##########
File path: dev/sparktestsupport/modules.py
##########
@@ -19,10 +19,28 @@
import itertools
import os
import re
+import glob
+
+from sparktestsupport import SPARK_HOME
all_modules = []
+def _discover_python_unittests(paths):
+ if not paths:
+ return set([])
+ tests = set([])
+ pyspark_path = os.path.join(SPARK_HOME, "python")
+ for path in paths:
+ # Discover the test*.py in every path
+ files = glob.glob(os.path.join(pyspark_path, path, "test_*.py"))
+ for f in files:
+ # Convert 'pyspark_path/pyspark/tests/test_abc.py' to
'pyspark.tests.test_abc'
+ file2module = os.path.relpath(f, pyspark_path)[:-3].replace("/",
".")
Review comment:
> I wonder if we can import pyspark and go through the sub packages
manually instead of going through the files ..
Yep, it's more accurate, I change the rules from "test_* discover" to
"unittest module discover", it will only discover the modules which are interit
from unittest.TestCase. See my latest change:
https://github.com/apache/spark/pull/32867/commits/9f4388a6ea8cb1f038b00a7f72ce92dd6bbb7845
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]