This is an automated email from the ASF dual-hosted git repository.
dongjoon-hyun pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 8fd5e76f015c [SPARK-54474][PYTHON] Discard the XML report on tests
that are supposed to fail
8fd5e76f015c is described below
commit 8fd5e76f015cb170e12881b78b8e352414193867
Author: Tian Gao <[email protected]>
AuthorDate: Mon Nov 24 14:59:14 2025 +0900
[SPARK-54474][PYTHON] Discard the XML report on tests that are supposed to
fail
### What changes were proposed in this pull request?
We do not keep the XML reports from the tests that are supposed to fail
anymore.
### Why are the changes needed?
It will confuse XML report consumers. These are tests that are supposed to
fail - we are testing if they return the expected return code.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Manually tested that no XML report is generated and the test itself still
passes.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #53187 from gaogaotiantian/disable-xml-on-failed-tests.
Authored-by: Tian Gao <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
(cherry picked from commit 0ba9a9bd8d6dad71a5938c5edfc2687aba7ef4f5)
Signed-off-by: Dongjoon Hyun <[email protected]>
---
python/pyspark/testing/tests/test_fail.py | 23 +++++++++++++---------
.../testing/tests/test_fail_in_set_up_class.py | 23 +++++++++++++---------
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/python/pyspark/testing/tests/test_fail.py
b/python/pyspark/testing/tests/test_fail.py
index d525cae8288f..6f86edd35a07 100644
--- a/python/pyspark/testing/tests/test_fail.py
+++ b/python/pyspark/testing/tests/test_fail.py
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+import tempfile
import unittest
@@ -25,13 +27,16 @@ class FailTests(unittest.TestCase):
if __name__ == "__main__":
from pyspark.testing.tests.test_fail import * # noqa: F401
- try:
- import xmlrunner
+ # Do not keep XML report because the test is supposed to fail.
+ # We do not want to confuse XML report consumers.
+ with tempfile.TemporaryDirectory() as tmpdir:
+ try:
+ import xmlrunner
- testRunner = xmlrunner.XMLTestRunner(output="target/test-reports",
verbosity=2)
- except ImportError:
- testRunner = None
- try:
- unittest.main(testRunner=testRunner, verbosity=2)
- except SystemExit as e:
- assert e.code == 1, f"status code: {e.code}"
+ testRunner = xmlrunner.XMLTestRunner(output=tmpdir, verbosity=2)
+ except ImportError:
+ testRunner = None
+ try:
+ unittest.main(testRunner=testRunner, verbosity=2)
+ except SystemExit as e:
+ assert e.code == 1, f"status code: {e.code}"
diff --git a/python/pyspark/testing/tests/test_fail_in_set_up_class.py
b/python/pyspark/testing/tests/test_fail_in_set_up_class.py
index e61f6db28825..4c13bf93ec00 100644
--- a/python/pyspark/testing/tests/test_fail_in_set_up_class.py
+++ b/python/pyspark/testing/tests/test_fail_in_set_up_class.py
@@ -14,6 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+
+import tempfile
import unittest
@@ -30,13 +32,16 @@ class FailInSetUpClassTests(unittest.TestCase):
if __name__ == "__main__":
from pyspark.testing.tests.test_fail_in_set_up_class import * # noqa: F401
- try:
- import xmlrunner
+ # Do not keep XML report because the test is supposed to fail.
+ # We do not want to confuse XML report consumers.
+ with tempfile.TemporaryDirectory() as tmpdir:
+ try:
+ import xmlrunner
- testRunner = xmlrunner.XMLTestRunner(output="target/test-reports",
verbosity=2)
- except ImportError:
- testRunner = None
- try:
- unittest.main(testRunner=testRunner, verbosity=2)
- except SystemExit as e:
- assert e.code == 1, f"status code: {e.code}"
+ testRunner = xmlrunner.XMLTestRunner(output=tmpdir, verbosity=2)
+ except ImportError:
+ testRunner = None
+ try:
+ unittest.main(testRunner=testRunner, verbosity=2)
+ except SystemExit as e:
+ assert e.code == 1, f"status code: {e.code}"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]