Skip to content

SPARK-7021 Add JUnit output for Python unit tests#8323

Closed
gliptak wants to merge 1 commit into
apache:masterfrom
gliptak:SPARK-7021
Closed

SPARK-7021 Add JUnit output for Python unit tests#8323
gliptak wants to merge 1 commit into
apache:masterfrom
gliptak:SPARK-7021

Conversation

@gliptak

@gliptak gliptak commented Aug 19, 2015

Copy link
Copy Markdown
Contributor

WIP

@JoshRosen

Copy link
Copy Markdown
Contributor

Jenkins, this is ok to test.

@SparkQA

SparkQA commented Aug 19, 2015

Copy link
Copy Markdown

Test build #41290 has finished for PR 8323 at commit d93e7cd.

  • This patch fails RAT tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class _DelegateIO(object):
    • class _TestInfo(object):
    • class _XMLTestResult(_TextTestResult):
    • class XMLTestRunner(TextTestRunner):

@gliptak

gliptak commented Aug 19, 2015

Copy link
Copy Markdown
Contributor Author

https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/41290/console
Recording test results
ERROR: Publisher 'Publish JUnit test result report' failed: No test report files were found. Configuration error?
Test FAILed.

Can somebody comment on how is Jenkins configured to look for JUnit results (or did this build fail on RAT)? Thanks

@JoshRosen

Copy link
Copy Markdown
Contributor

The build failed on RAT:

Could not find Apache license headers in the following files:
 !????? /home/jenkins/workspace/SparkPullRequestBuilder/dev/xmlrunner/__init__.py
 !????? /home/jenkins/workspace/SparkPullRequestBuilder/dev/xmlrunner/xmlrunner.py
[error] running /home/jenkins/workspace/SparkPullRequestBuilder/dev/check-license ; received return code 1

@gliptak

gliptak commented Aug 19, 2015

Copy link
Copy Markdown
Contributor Author

I just added the headers, xmlrunner is LGPL (and only used to run the tests).

@SparkQA

SparkQA commented Aug 19, 2015

Copy link
Copy Markdown

Test build #41291 has finished for PR 8323 at commit d4f48ba.

  • This patch fails RAT tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class _DelegateIO(object):
    • class _TestInfo(object):
    • class _XMLTestResult(_TextTestResult):
    • class XMLTestRunner(TextTestRunner):

@gliptak

gliptak commented Aug 20, 2015

Copy link
Copy Markdown
Contributor Author

Is this a no-go because of the license? Thanks

@mengxr

mengxr commented Sep 22, 2015

Copy link
Copy Markdown
Contributor

@gliptak Is https://pypi.python.org/pypi/unittest-xml-reporting/1.12.0 an alternative? It is BSD license. We can install the package on Jenkins machines, instead of including the source code in the codebase.

@gliptak

gliptak commented Sep 23, 2015

Copy link
Copy Markdown
Contributor Author

@mengxr Would installing on Jenkins be independent from the codebase (the import xmlrunner just be available)? Thanks

@mengxr

mengxr commented Sep 23, 2015

Copy link
Copy Markdown
Contributor

If this new library works, I think we could install it on Spark Jenkins. Could you test it locally and see whether it works?

@gliptak

gliptak commented Sep 23, 2015

Copy link
Copy Markdown
Contributor Author

I tried this locally and the files were generated. Somebody with visibility on Jenkins might need to comment on file locations ...

@SparkQA

SparkQA commented Sep 23, 2015

Copy link
Copy Markdown

Test build #42930 has finished for PR 8323 at commit a6b3a5b.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA

SparkQA commented Sep 23, 2015

Copy link
Copy Markdown

Test build #42933 has finished for PR 8323 at commit 05e5a37.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA

SparkQA commented Sep 23, 2015

Copy link
Copy Markdown

Test build #42935 has finished for PR 8323 at commit 18f5901.

  • This patch fails Python style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Sep 24, 2015

Copy link
Copy Markdown
Contributor

Please fix Python style issue:

./python/pyspark/streaming/tests.py:1303:13: E128 continuation line under-indented for visual indent

Comment thread python/pyspark/streaming/tests.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be aligned with tests,. you can run dev/lint-python to check style locally.

@gliptak

gliptak commented Sep 24, 2015

Copy link
Copy Markdown
Contributor Author

@mengxr Thanks for the local lint pointer

@SparkQA

SparkQA commented Sep 24, 2015

Copy link
Copy Markdown

Test build #42980 has finished for PR 8323 at commit e9a711e.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Sep 24, 2015

Copy link
Copy Markdown
Contributor

@shaneknapp Could you take a look at this PR and see whether we can install https://pypi.python.org/pypi/unittest-xml-reporting/1.12.0 on Jenkins?

@gliptak We shouldn't make xmlrunner a requirement on local machines. If it is installed, we output XML. Otherwise, we should fallback to the default behavior. This could be done by catching exceptions at the import line.

@shaneknapp

Copy link
Copy Markdown
Contributor

could you create a spark issue for the plugin and assign it to me?

also, i won't be able to do this until monday, as i'm about to leave town
for the weekend.

On Thu, Sep 24, 2015 at 2:50 PM, Xiangrui Meng notifications@github.com
wrote:

@shaneknapp https://github.com/shaneknapp Could you take a look at this
PR and see whether we can install
https://pypi.python.org/pypi/unittest-xml-reporting/1.12.0 on Jenkins?

@gliptak https://github.com/gliptak We shouldn't make xmlrunner a
requirement on local machines. If it is installed, we output XML.
Otherwise, we should fallback to the default behavior. This could be done
by catching exceptions at the import line.


Reply to this email directly or view it on GitHub
#8323 (comment).

@gliptak

gliptak commented Sep 25, 2015

Copy link
Copy Markdown
Contributor Author

@mengxr Revised.

@SparkQA

SparkQA commented Sep 25, 2015

Copy link
Copy Markdown

Test build #42996 has finished for PR 8323 at commit 66bdb2b.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Sep 25, 2015

Copy link
Copy Markdown
Contributor

@shaneknapp I created https://issues.apache.org/jira/browse/SPARK-10830 and assigned it to you.

@mengxr

mengxr commented Sep 25, 2015

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Sep 25, 2015

Copy link
Copy Markdown

Test build #43015 has finished for PR 8323 at commit 66bdb2b.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

test this please

@mengxr

mengxr commented Sep 28, 2015

Copy link
Copy Markdown
Contributor

unittest-xml-reporting is installed on AMPLab Jenkins. So let's call Jenkins again.

@SparkQA

SparkQA commented Sep 29, 2015

Copy link
Copy Markdown

Test build #1821 has finished for PR 8323 at commit 66bdb2b.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gliptak

gliptak commented Sep 29, 2015

Copy link
Copy Markdown
Contributor Author

https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1810/testReport/

doesn't seem to list the Python tests.

Can somebody with access to Jenkins configuration review?

Thanks

@shaneknapp

Copy link
Copy Markdown
Contributor

i'll take a look at the config tomorrow

On Mon, Sep 28, 2015 at 6:02 PM, gliptak notifications@github.com wrote:

https://amplab.cs.berkeley.edu/jenkins/job/NewSparkPullRequestBuilder/1810/testReport/

doesn't seem to list the Python tests.

Can somebody with access to Jenkins configuration review?

Thanks


Reply to this email directly or view it on GitHub
#8323 (comment).

@mengxr

mengxr commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Sep 30, 2015

Copy link
Copy Markdown

Test build #43109 has finished for PR 8323 at commit cd654c7.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Sep 30, 2015

Copy link
Copy Markdown

Test build #43113 has finished for PR 8323 at commit cd654c7.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gliptak

gliptak commented Sep 30, 2015

Copy link
Copy Markdown
Contributor Author

@mengxr Thank you for guiding this

@mengxr

mengxr commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

test this please

@mengxr

mengxr commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

it seems that this PR has a higher-than-normal failure rate .. I don't know why. +@davies

@SparkQA

SparkQA commented Oct 2, 2015

Copy link
Copy Markdown

Test build #43176 has finished for PR 8323 at commit cd654c7.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr

mengxr commented Oct 5, 2015

Copy link
Copy Markdown
Contributor

test this please

@SparkQA

SparkQA commented Oct 5, 2015

Copy link
Copy Markdown

Test build #43252 has finished for PR 8323 at commit cd654c7.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@JoshRosen

Copy link
Copy Markdown
Contributor

Huh, looks like the last two failures were for the same PySpark test:

======================================================================
FAIL [0.000s]: test_pickling_file_handles (__main__.SerializationTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/workspace/SparkPullRequestBuilder/python/pyspark/tests.py", line 259, in test_pickling_file_handles
    self.assertEqual(out1, out2)
AssertionError: <StringIO.StringIO instance at 0x2d65a28> != <StringIO.StringIO instance at 0x2ffdb90>

@JoshRosen

Copy link
Copy Markdown
Contributor

I guess that this doesn't handle doctests, right? Is there any way to get XML for those, too? If not, could you edit the PR title / description to reflect this?

@JoshRosen

Copy link
Copy Markdown
Contributor

@gliptak, can you try to reproduce the failure locally? See ./pyspark/run-tests --help for hints on how to run only this test suite under Python 2.6.

@gliptak

gliptak commented Oct 7, 2015

Copy link
Copy Markdown
Contributor Author

@JoshRosen I do not have python2.6 installed (or available as a package) locally

@gliptak

gliptak commented Oct 8, 2015

Copy link
Copy Markdown
Contributor Author

@JoshRosen How are the doctest-s triggered on the commandline and in Jenkins?

$ python/run-tests --help
No handlers could be found for logger "root"
Usage: run-tests [options]

Options:
  -h, --help            show this help message and exit
  --python-executables=PYTHON_EXECUTABLES
                        A comma-separated list of Python executables to test
                        against (default: python,python3.4)
  --modules=MODULES     A comma-separated list of Python modules to test
                        (default: pyspark-core,pyspark-ml,pyspark-mllib
                        ,pyspark-sql,pyspark-streaming)
  -p PARALLELISM, --parallelism=PARALLELISM
                        The number of suites to test in parallel (default 4)
  --verbose             Enable additional debug logging

@gliptak

gliptak commented Oct 14, 2015

Copy link
Copy Markdown
Contributor Author

What is the next step on this pull request? Thanks

@mengxr

mengxr commented Oct 16, 2015

Copy link
Copy Markdown
Contributor

@gliptak I had an offline discussion with @davies . Let's do the following:

  1. Change L259 in pyspark/tests.py to:

      # Regression test for SPARK-3415
      def test_pickling_file_handles(self):
          # JIRA number here
          if xmlrunner is None:
              ser = CloudPickleSerializer()
              out1 = sys.stderr
              out2 = ser.loads(ser.dumps(out1))
              self.assertEqual(out1, out2)

    Create a JIRA for this so we remember to fix it. The issue is CloudPickeSerializer wraps stderr, which conflicts with xmlrunner. But it might take some time to fix.

  2. Change the PR title to `Python unit tests" since we do not report doctests.

Then we can run Jenkins again and see whether it works.

@gliptak gliptak changed the title SPARK-7021 Add JUnit output for Python tests SPARK-7021 Add JUnit output for Python unit tests Oct 16, 2015
@SparkQA

SparkQA commented Oct 16, 2015

Copy link
Copy Markdown

Test build #43863 has finished for PR 8323 at commit 177fef9.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@davies

davies commented Oct 16, 2015

Copy link
Copy Markdown
Contributor

Right now, all the Python unit tests are in the package of (root), is there a way to set a package for it (such as pyspark)?

@gliptak

gliptak commented Oct 16, 2015

Copy link
Copy Markdown
Contributor Author

@davies Not that I see. I opened xmlrunner/unittest-xml-reporting#95 to discuss.

@gliptak

gliptak commented Oct 16, 2015

Copy link
Copy Markdown
Contributor Author

@JoshRosen I opened xmlrunner/unittest-xml-reporting#94 to discuss doctests processing.

@mengxr

mengxr commented Oct 22, 2015

Copy link
Copy Markdown
Contributor

This looks good to me. I think we can address the test namespace issue in a later PR. @davies @JoshRosen ?

@davies

davies commented Oct 22, 2015

Copy link
Copy Markdown
Contributor

LGTM, merging this into master, thanks!

@asfgit asfgit closed this in 163d53e Oct 22, 2015
@gliptak

gliptak commented Oct 22, 2015

Copy link
Copy Markdown
Contributor Author

As per xmlrunner/unittest-xml-reporting#95 the Python tests do not have packages (or possibly not being recognized by https://github.com/xmlrunner/unittest-xml-reporting/

@gliptak

gliptak commented Oct 24, 2015

Copy link
Copy Markdown
Contributor Author

Adding packages to XMLs at #9263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants