diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-29 08:30:26 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-08-29 08:30:26 -0400 |
commit | 353dff3141e8e0ea3d92ef63f74bcd3729febb42 (patch) | |
tree | c7d28c8a6822a2b899957407dd5c77ccae7ea47d | |
parent | 3044844aec378123651e492095073345521989f4 (diff) | |
download | python-coveragepy-git-353dff3141e8e0ea3d92ef63f74bcd3729febb42.tar.gz |
Accommodate strange ShiningPanda logic if we are running under Jenkins. #404
-rw-r--r-- | CHANGES.txt | 6 | ||||
-rw-r--r-- | coverage/html.py | 7 | ||||
-rw-r--r-- | tests/test_html.py | 8 |
3 files changed, 21 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c5b20c3a..ec14f368 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -12,7 +12,13 @@ Latest - Reporting on an unmeasured file would fail with a traceback. This is now fixed, closing `issue 403`_. +- The Jenkins ShiningPanda plugin looks for an obsolete file name to find the + HTML reports to publish, so it was failing under coverage.py 4.0. Now we + create that file if we are running under Jenkins, to keep things working + smoothly. `issue 404`_. + .. _issue 403: https://bitbucket.org/ned/coveragepy/issues/403/hasherupdate-fails-with-typeerror-nonetype +.. _issue 404: https://bitbucket.org/ned/coveragepy/issues/404/shiningpanda-jenkins-plugin-cant-find-html diff --git a/coverage/html.py b/coverage/html.py index 8c306c62..de18cefa 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -381,6 +381,13 @@ class HtmlStatus(object): with open(status_file, "w") as fout: json.dump(status, fout) + # Older versions of ShiningPanda look for the old name, status.dat. + # Accomodate them if we are running under Jenkins. + # https://issues.jenkins-ci.org/browse/JENKINS-28428 + if "JENKINS_URL" in os.environ: + with open(os.path.join(directory, "status.dat"), "w") as dat: + dat.write("https://issues.jenkins-ci.org/browse/JENKINS-28428\n") + def settings_hash(self): """Get the hash of the coverage.py settings.""" return self.settings diff --git a/tests/test_html.py b/tests/test_html.py index a852cbe9..a30d0e39 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -397,6 +397,14 @@ class HtmlTest(HtmlTestHelpers, CoverageTest): self.assert_exists("htmlcov/index.html") self.assert_exists("htmlcov/other_py.html") + def test_shining_panda_fix(self): + # The ShiningPanda plugin looks for "status.dat" to find HTML reports. + # Accomodate them, but only if we are running under Jenkins. + self.set_environ("JENKINS_URL", "Something or other") + self.create_initial_files() + self.run_coverage() + self.assert_exists("htmlcov/status.dat") + class HtmlStaticFileTest(CoverageTest): """Tests of the static file copying for the HTML report.""" |