diff options
Diffstat (limited to 'tests')
155 files changed, 4187 insertions, 2550 deletions
diff --git a/tests/backtest.py b/tests/backtest.py index 50834721..827e891f 100644 --- a/tests/backtest.py +++ b/tests/backtest.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Add things to old Pythons so I can pretend they are newer, for tests.""" # pylint: disable=redefined-builtin diff --git a/tests/coveragetest.py b/tests/coveragetest.py index 0e80f4a9..9e0bb26e 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -1,5 +1,9 @@ -"""Base test case class for coverage testing.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt +"""Base test case class for coverage.py testing.""" + +import datetime import glob import os import random @@ -11,7 +15,8 @@ import sys import coverage from coverage.backunittest import TestCase from coverage.backward import StringIO, import_local_file, string_class -from coverage.control import _TEST_NAME_FILE +from coverage.cmdline import CoverageScript +from coverage.debug import _TEST_NAME_FILE, DebugControl from coverage.test_helpers import ( EnvironmentAwareMixin, StdStreamCapturingMixin, TempDirMixin, ) @@ -31,7 +36,7 @@ class CoverageTest( TempDirMixin, TestCase ): - """A base class for Coverage test cases.""" + """A base class for coverage.py test cases.""" # Standard unittest setting: show me diffs even if they are very long. maxDiff = None @@ -93,7 +98,7 @@ class CoverageTest( # Import the Python file, executing it. mod = self.import_local_file(modname) finally: # pragma: nested - # Stop Coverage. + # Stop coverage.py. cov.stop() return mod @@ -170,7 +175,7 @@ class CoverageTest( """ # We write the code into a file so that we can import it. - # Coverage wants to deal with things as modules with file names. + # Coverage.py wants to deal with things as modules with file names. modname = self.get_module_name() self.make_file(modname+".py", text) @@ -182,8 +187,8 @@ class CoverageTest( if arcs_unpredicted is None and arcz_unpredicted is not None: arcs_unpredicted = self.arcz_to_arcs(arcz_unpredicted) - # Start up Coverage. - cov = coverage.coverage(branch=(arcs_missing is not None)) + # Start up coverage.py. + cov = coverage.Coverage(branch=(arcs_missing is not None)) cov.erase() for exc in excludes or []: cov.exclude(exc) @@ -278,6 +283,14 @@ class CoverageTest( if not s.startswith(prefix): self.fail(msg or ("%r doesn't start with %r" % (s, prefix))) + def assert_recent_datetime(self, dt, seconds=10, msg=None): + """Assert that `dt` marks a time at most `seconds` seconds ago.""" + age = datetime.datetime.now() - dt + # Python2.6 doesn't have total_seconds :( + self.assertEqual(age.days, 0, msg) + self.assertGreaterEqual(age.seconds, 0, msg) + self.assertLessEqual(age.seconds, seconds, msg) + def command_line(self, args, ret=OK, _covpkg=None): """Run `args` through the command line. @@ -290,7 +303,7 @@ class CoverageTest( Returns None. """ - script = coverage.CoverageScript(_covpkg=_covpkg) + script = CoverageScript(_covpkg=_covpkg) ret_actual = script.command_line(shlex.split(args)) self.assertEqual(ret_actual, ret) @@ -364,3 +377,13 @@ class CoverageTest( def last_line_squeezed(self, report): """Return the last line of `report` with the spaces squeezed down.""" return self.squeezed_lines(report)[-1] + + +class DebugControlString(DebugControl): + """A `DebugControl` that writes to a StringIO, for testing.""" + def __init__(self, options): + super(DebugControlString, self).__init__(options, StringIO()) + + def get_output(self): + """Get the output text from the `DebugControl`.""" + return self.output.getvalue() diff --git a/tests/covmodzip1.py b/tests/covmodzip1.py index 3ec4cdc4..6f135dd6 100644 --- a/tests/covmodzip1.py +++ b/tests/covmodzip1.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """covmodzip.py: for putting into a zip file.""" j = 1 j += 1 diff --git a/tests/eggsrc/egg1/egg1.py b/tests/eggsrc/egg1/egg1.py index 3fadde33..72600808 100644 --- a/tests/eggsrc/egg1/egg1.py +++ b/tests/eggsrc/egg1/egg1.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # My egg file! walrus = "Eggman" diff --git a/tests/eggsrc/setup.py b/tests/eggsrc/setup.py index f9b8b9d0..c935798d 100644 --- a/tests/eggsrc/setup.py +++ b/tests/eggsrc/setup.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + from setuptools import setup setup( diff --git a/tests/farm/annotate/annotate_dir.py b/tests/farm/annotate/annotate_dir.py index 86c18cab..3bb2dbe7 100644 --- a/tests/farm/annotate/annotate_dir.py +++ b/tests/farm/annotate/annotate_dir.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + copy("src", "run") run(""" coverage run multi.py diff --git a/tests/farm/annotate/gold/white.py,cover b/tests/farm/annotate/gold/white.py,cover index 36b0b993..fc163226 100644 --- a/tests/farm/annotate/gold/white.py,cover +++ b/tests/farm/annotate/gold/white.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # A test case sent to me by Steve White > def f(self): diff --git a/tests/farm/annotate/gold_anno_dir/a_a.py,cover b/tests/farm/annotate/gold_anno_dir/a_a.py,cover index d0ff3c0c..4729cfbb 100644 --- a/tests/farm/annotate/gold_anno_dir/a_a.py,cover +++ b/tests/farm/annotate/gold_anno_dir/a_a.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > def a(x): > if x == 1: > print("x is 1") diff --git a/tests/farm/annotate/gold_anno_dir/b_b.py,cover b/tests/farm/annotate/gold_anno_dir/b_b.py,cover index 90d076f1..228715f0 100644 --- a/tests/farm/annotate/gold_anno_dir/b_b.py,cover +++ b/tests/farm/annotate/gold_anno_dir/b_b.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > def b(x): > msg = "x is %s" % x > print(msg) diff --git a/tests/farm/annotate/gold_anno_dir/multi.py,cover b/tests/farm/annotate/gold_anno_dir/multi.py,cover index 2a5c59ce..90a13c91 100644 --- a/tests/farm/annotate/gold_anno_dir/multi.py,cover +++ b/tests/farm/annotate/gold_anno_dir/multi.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > import a.a > import b.b diff --git a/tests/farm/annotate/gold_encodings/utf8.py,cover b/tests/farm/annotate/gold_encodings/utf8.py,cover new file mode 100644 index 00000000..3ef31e0f --- /dev/null +++ b/tests/farm/annotate/gold_encodings/utf8.py,cover @@ -0,0 +1,7 @@ + # -*- coding: utf-8 -*- + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + + # This comment has an accent: é + +> print("spam eggs") diff --git a/tests/farm/annotate/gold_multi/a/a.py,cover b/tests/farm/annotate/gold_multi/a/a.py,cover index fb3f5435..e5e97226 100644 --- a/tests/farm/annotate/gold_multi/a/a.py,cover +++ b/tests/farm/annotate/gold_multi/a/a.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > def a(x): > if x == 1: > print "x is 1" diff --git a/tests/farm/annotate/gold_multi/b/b.py,cover b/tests/farm/annotate/gold_multi/b/b.py,cover index a3f5daec..26b25548 100644 --- a/tests/farm/annotate/gold_multi/b/b.py,cover +++ b/tests/farm/annotate/gold_multi/b/b.py,cover @@ -1,2 +1,5 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > def b(x): > print "x is %s" % x diff --git a/tests/farm/annotate/gold_multi/multi.py,cover b/tests/farm/annotate/gold_multi/multi.py,cover index 2a5c59ce..90a13c91 100644 --- a/tests/farm/annotate/gold_multi/multi.py,cover +++ b/tests/farm/annotate/gold_multi/multi.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + > import a.a > import b.b diff --git a/tests/farm/annotate/gold_v24/white.py,cover b/tests/farm/annotate/gold_v24/white.py,cover index bbd8d428..8af136b8 100644 --- a/tests/farm/annotate/gold_v24/white.py,cover +++ b/tests/farm/annotate/gold_v24/white.py,cover @@ -1,3 +1,6 @@ + # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 + # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # A test case sent to me by Steve White > def f(self): diff --git a/tests/farm/annotate/run.py b/tests/farm/annotate/run.py index 236f401f..33e5f671 100644 --- a/tests/farm/annotate/run.py +++ b/tests/farm/annotate/run.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + copy("src", "out") run(""" coverage run white.py diff --git a/tests/farm/annotate/run_encodings.py b/tests/farm/annotate/run_encodings.py new file mode 100644 index 00000000..527cd88f --- /dev/null +++ b/tests/farm/annotate/run_encodings.py @@ -0,0 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +copy("src", "out") +run(""" + coverage run utf8.py + coverage annotate utf8.py + """, rundir="out") +compare("out", "gold_encodings", "*,cover") +clean("out") diff --git a/tests/farm/annotate/run_multi.py b/tests/farm/annotate/run_multi.py index ef1e8238..4646293e 100644 --- a/tests/farm/annotate/run_multi.py +++ b/tests/farm/annotate/run_multi.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + copy("src", "out_multi") run(""" coverage run multi.py diff --git a/tests/farm/annotate/src/a/a.py b/tests/farm/annotate/src/a/a.py index c2583d1e..e3e6631d 100644 --- a/tests/farm/annotate/src/a/a.py +++ b/tests/farm/annotate/src/a/a.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def a(x): if x == 1: print("x is 1") diff --git a/tests/farm/annotate/src/b/b.py b/tests/farm/annotate/src/b/b.py index 625a5490..b31d8c95 100644 --- a/tests/farm/annotate/src/b/b.py +++ b/tests/farm/annotate/src/b/b.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def b(x): msg = "x is %s" % x print(msg) diff --git a/tests/farm/annotate/src/multi.py b/tests/farm/annotate/src/multi.py index 19a6200c..bf8cfd5f 100644 --- a/tests/farm/annotate/src/multi.py +++ b/tests/farm/annotate/src/multi.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import a.a import b.b diff --git a/tests/farm/annotate/src/utf8.py b/tests/farm/annotate/src/utf8.py new file mode 100644 index 00000000..fd43b2ab --- /dev/null +++ b/tests/farm/annotate/src/utf8.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# This comment has an accent: é + +print("spam eggs") diff --git a/tests/farm/annotate/src/white.py b/tests/farm/annotate/src/white.py index ecbbd25a..21e8a627 100644 --- a/tests/farm/annotate/src/white.py +++ b/tests/farm/annotate/src/white.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # A test case sent to me by Steve White def f(self): diff --git a/tests/farm/html/gold_a/a_py.html b/tests/farm/html/gold_a/a_py.html index 03c1fc95..e52b303e 100644 --- a/tests/farm/html/gold_a/a_py.html +++ b/tests/farm/html/gold_a/a_py.html @@ -1,96 +1,106 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for a: 67%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for a.py: 67%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>a</b> : - <span class='pc_cov'>67%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>a.py</b> : + <span class="pc_cov">67%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 3 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>1 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">1 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='pln'><a href='#n6'>6</a></p> -<p id='n7' class='stm mis'><a href='#n7'>7</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="pln"><a href="#n9">9</a></p> +<p id="n10" class="stm mis"><a href="#n10">10</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>if</span> <span class='num'>1</span> <span class='op'><</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t4' class='pln'> <span class='com'># Needed a < to look at HTML entities.</span><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'> </span></p> -<p id='t6' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t7' class='stm mis'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># A test file for HTML reporting by coverage.py.</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">if</span> <span class="num">1</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t7" class="pln"> <span class="com"># Needed a < to look at HTML entities.</span><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span><span class="strut"> </span></p> +<p id="t9" class="pln"><span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t10" class="stm mis"> <span class="nam">a</span> <span class="op">=</span> <span class="num">4</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_a/index.html b/tests/farm/html/gold_a/index.html index 4a79fc57..4f462fe7 100644 --- a/tests/farm/html/gold_a/index.html +++ b/tests/farm/html/gold_a/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>67%</span> + <span class="pc_cov">67%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,54 +33,54 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>3</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='2 3'>67%</td> + <td class="right" data-ratio="2 3">67%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='a.html'>a</a></td> + <tr class="file"> + <td class="name left"><a href="a_py.html">a.py</a></td> <td>3</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='2 3'>67%</td> + <td class="right" data-ratio="2 3">67%</td> </tr> </tbody> @@ -88,10 +91,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_b_branch/b_py.html b/tests/farm/html/gold_b_branch/b_py.html index 15b06661..4ee9e1c4 100644 --- a/tests/farm/html/gold_b_branch/b_py.html +++ b/tests/farm/html/gold_b_branch/b_py.html @@ -1,142 +1,152 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for b: 70%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for b.py: 70%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>b</b> : - <span class='pc_cov'>70%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>b.py</b> : + <span class="pc_cov">70%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 17 statements - <span class='run hide_run shortkey_r button_toggle_run'>14 run</span> - <span class='mis shortkey_m button_toggle_mis'>3 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">14 run</span> + <span class="mis shortkey_m button_toggle_mis">3 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> - <span class='par run hide_run shortkey_p button_toggle_par'>4 partial</span> + <span class="par run hide_run shortkey_p button_toggle_par">4 partial</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm par run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm mis'><a href='#n8'>8</a></p> -<p id='n9' class='pln'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> -<p id='n11' class='pln'><a href='#n11'>11</a></p> -<p id='n12' class='stm run hide_run'><a href='#n12'>12</a></p> -<p id='n13' class='pln'><a href='#n13'>13</a></p> -<p id='n14' class='stm par run hide_run'><a href='#n14'>14</a></p> -<p id='n15' class='stm run hide_run'><a href='#n15'>15</a></p> -<p id='n16' class='pln'><a href='#n16'>16</a></p> -<p id='n17' class='stm run hide_run'><a href='#n17'>17</a></p> -<p id='n18' class='pln'><a href='#n18'>18</a></p> -<p id='n19' class='stm run hide_run'><a href='#n19'>19</a></p> -<p id='n20' class='stm run hide_run'><a href='#n20'>20</a></p> -<p id='n21' class='pln'><a href='#n21'>21</a></p> -<p id='n22' class='stm par run hide_run'><a href='#n22'>22</a></p> -<p id='n23' class='stm mis'><a href='#n23'>23</a></p> -<p id='n24' class='pln'><a href='#n24'>24</a></p> -<p id='n25' class='stm mis'><a href='#n25'>25</a></p> -<p id='n26' class='stm run hide_run'><a href='#n26'>26</a></p> -<p id='n27' class='stm run hide_run'><a href='#n27'>27</a></p> -<p id='n28' class='pln'><a href='#n28'>28</a></p> -<p id='n29' class='stm run hide_run'><a href='#n29'>29</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm par run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm mis"><a href="#n11">11</a></p> +<p id="n12" class="pln"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> +<p id="n14" class="pln"><a href="#n14">14</a></p> +<p id="n15" class="stm run hide_run"><a href="#n15">15</a></p> +<p id="n16" class="pln"><a href="#n16">16</a></p> +<p id="n17" class="stm par run hide_run"><a href="#n17">17</a></p> +<p id="n18" class="stm run hide_run"><a href="#n18">18</a></p> +<p id="n19" class="pln"><a href="#n19">19</a></p> +<p id="n20" class="stm run hide_run"><a href="#n20">20</a></p> +<p id="n21" class="pln"><a href="#n21">21</a></p> +<p id="n22" class="stm run hide_run"><a href="#n22">22</a></p> +<p id="n23" class="stm run hide_run"><a href="#n23">23</a></p> +<p id="n24" class="pln"><a href="#n24">24</a></p> +<p id="n25" class="stm par run hide_run"><a href="#n25">25</a></p> +<p id="n26" class="stm mis"><a href="#n26">26</a></p> +<p id="n27" class="pln"><a href="#n27">27</a></p> +<p id="n28" class="stm mis"><a href="#n28">28</a></p> +<p id="n29" class="stm run hide_run"><a href="#n29">29</a></p> +<p id="n30" class="stm run hide_run"><a href="#n30">30</a></p> +<p id="n31" class="pln"><a href="#n31">31</a></p> +<p id="n32" class="stm run hide_run"><a href="#n32">32</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>one</span><span class='op'>(</span><span class='nam'>x</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t4' class='pln'> <span class='com'># This will be a branch that misses the else.</span><span class='strut'> </span></p> -<p id='t5' class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>8</span> <span class='key'>if</span> <span class='nam'>x</span> <span class='op'><</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'> </span></p> -<p id='t7' class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t8' class='stm mis'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'> </span></p> -<p id='t9' class='pln'><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='nam'>one</span><span class='op'>(</span><span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p> -<p id='t11' class='pln'><span class='strut'> </span></p> -<p id='t12' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>two</span><span class='op'>(</span><span class='nam'>x</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t13' class='pln'> <span class='com'># A missed else that branches to "exit"</span><span class='strut'> </span></p> -<p id='t14' class='stm par run hide_run'><span class='annotate' title='no jump to this line number'>exit</span> <span class='key'>if</span> <span class='nam'>x</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t15' class='stm run hide_run'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t16' class='pln'><span class='strut'> </span></p> -<p id='t17' class='stm run hide_run'><span class='nam'>two</span><span class='op'>(</span><span class='num'>1</span><span class='op'>)</span><span class='strut'> </span></p> -<p id='t18' class='pln'><span class='strut'> </span></p> -<p id='t19' class='stm run hide_run'><span class='key'>def</span> <span class='nam'>three</span><span class='op'>(</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t20' class='stm run hide_run'> <span class='key'>try</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t21' class='pln'> <span class='com'># This if has two branches, *neither* one taken.</span><span class='strut'> </span></p> -<p id='t22' class='stm par run hide_run'><span class='annotate' title='no jumps to these line numbers'>23 25</span> <span class='key'>if</span> <span class='nam'>name_error_this_variable_doesnt_exist</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t23' class='stm mis'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t24' class='pln'> <span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t25' class='stm mis'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> -<p id='t26' class='stm run hide_run'> <span class='key'>except</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t27' class='stm run hide_run'> <span class='key'>pass</span><span class='strut'> </span></p> -<p id='t28' class='pln'><span class='strut'> </span></p> -<p id='t29' class='stm run hide_run'><span class='nam'>three</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># A test file for HTML reporting by coverage.py.</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">def</span> <span class="nam">one</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t7" class="pln"> <span class="com"># This will be a branch that misses the else.</span><span class="strut"> </span></p> +<p id="t8" class="stm par run hide_run"><span class="annotate" title="no jump to this line number">11</span> <span class="key">if</span> <span class="nam">x</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span><span class="strut"> </span></p> +<p id="t10" class="pln"> <span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t11" class="stm mis"> <span class="nam">a</span> <span class="op">=</span> <span class="num">4</span><span class="strut"> </span></p> +<p id="t12" class="pln"><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="nam">one</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="strut"> </span></p> +<p id="t14" class="pln"><span class="strut"> </span></p> +<p id="t15" class="stm run hide_run"><span class="key">def</span> <span class="nam">two</span><span class="op">(</span><span class="nam">x</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t16" class="pln"> <span class="com"># A missed else that branches to "exit"</span><span class="strut"> </span></p> +<p id="t17" class="stm par run hide_run"><span class="annotate" title="no jump to this line number">exit</span> <span class="key">if</span> <span class="nam">x</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t18" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t19" class="pln"><span class="strut"> </span></p> +<p id="t20" class="stm run hide_run"><span class="nam">two</span><span class="op">(</span><span class="num">1</span><span class="op">)</span><span class="strut"> </span></p> +<p id="t21" class="pln"><span class="strut"> </span></p> +<p id="t22" class="stm run hide_run"><span class="key">def</span> <span class="nam">three</span><span class="op">(</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t23" class="stm run hide_run"> <span class="key">try</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t24" class="pln"> <span class="com"># This if has two branches, *neither* one taken.</span><span class="strut"> </span></p> +<p id="t25" class="stm par run hide_run"><span class="annotate" title="no jumps to these line numbers">26 28</span> <span class="key">if</span> <span class="nam">name_error_this_variable_doesnt_exist</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t26" class="stm mis"> <span class="nam">a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t27" class="pln"> <span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t28" class="stm mis"> <span class="nam">a</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> +<p id="t29" class="stm run hide_run"> <span class="key">except</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t30" class="stm run hide_run"> <span class="key">pass</span><span class="strut"> </span></p> +<p id="t31" class="pln"><span class="strut"> </span></p> +<p id="t32" class="stm run hide_run"><span class="nam">three</span><span class="op">(</span><span class="op">)</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_b_branch/index.html b/tests/farm/html/gold_b_branch/index.html index be4adc89..ebc3a106 100644 --- a/tests/farm/html/gold_b_branch/index.html +++ b/tests/farm/html/gold_b_branch/index.html @@ -1,28 +1,28 @@ <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>70%</span> + <span class="pc_cov">70%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,44 +30,44 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>b</span> - <span class='key'>p</span> + <span class="key">b</span> + <span class="key">p</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='shortkey_b'>branches</th> - <th class='shortkey_p'>partial</th> + <th class="shortkey_b">branches</th> + <th class="shortkey_p">partial</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>17</td> <td>3</td> <td>0</td> @@ -75,13 +75,13 @@ <td>6</td> <td>4</td> - <td class='right' data-ratio='16 23'>70%</td> + <td class="right" data-ratio="16 23">70%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='b.html'>b</a></td> + <tr class="file"> + <td class="name left"><a href="b.html">b</a></td> <td>17</td> <td>3</td> <td>0</td> @@ -89,7 +89,7 @@ <td>6</td> <td>4</td> - <td class='right' data-ratio='16 23'>70%</td> + <td class="right" data-ratio="16 23">70%</td> </tr> </tbody> @@ -100,10 +100,10 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="http://nedbatchelder.com/code/coverage/4.0a1">coverage.py v4.0a1</a> </p> </div> </div> diff --git a/tests/farm/html/gold_bom/bom_py.html b/tests/farm/html/gold_bom/bom_py.html index 40c64bdb..127f2f45 100644 --- a/tests/farm/html/gold_bom/bom_py.html +++ b/tests/farm/html/gold_bom/bom_py.html @@ -1,104 +1,104 @@ <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> <title>Coverage for bom: 71%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage for <b>bom</b> : - <span class='pc_cov'>71%</span> + <span class="pc_cov">71%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 7 statements - <span class='run hide_run shortkey_r button_toggle_run'>5 run</span> - <span class='mis shortkey_m button_toggle_mis'>2 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">5 run</span> + <span class="mis shortkey_m button_toggle_mis">2 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='pln'><a href='#n3'>3</a></p> -<p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p> -<p id='n5' class='pln'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='stm mis'><a href='#n7'>7</a></p> -<p id='n8' class='stm mis'><a href='#n8'>8</a></p> -<p id='n9' class='pln'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> -<p id='n11' class='stm run hide_run'><a href='#n11'>11</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="stm run hide_run"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="stm mis"><a href="#n7">7</a></p> +<p id="n8" class="stm mis"><a href="#n8">8</a></p> +<p id="n9" class="pln"><a href="#n9">9</a></p> +<p id="n10" class="stm run hide_run"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='err'>�</span><span class='err'>�</span><span class='err'>�</span><span class='com'># A python source file in utf-8, with BOM</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>math</span> <span class='op'>=</span> <span class='str'>"3×4 = 12, ÷2 = 6±0"</span><span class='strut'> </span></p> -<p id='t3' class='pln'><span class='strut'> </span></p> -<p id='t4' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>sys</span><span class='strut'> </span></p> -<p id='t5' class='pln'><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='key'>if</span> <span class='nam'>sys</span><span class='op'>.</span><span class='nam'>version_info</span> <span class='op'>>=</span> <span class='op'>(</span><span class='num'>3</span><span class='op'>,</span> <span class='num'>0</span><span class='op'>)</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t7' class='stm mis'> <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>18</span><span class='strut'> </span></p> -<p id='t8' class='stm mis'> <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>.</span><span class='nam'>encode</span><span class='op'>(</span><span class='str'>'utf-8'</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>21</span><span class='strut'> </span></p> -<p id='t9' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'> <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>21</span><span class='strut'> </span></p> -<p id='t11' class='stm run hide_run'> <span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>.</span><span class='nam'>decode</span><span class='op'>(</span><span class='str'>'utf-8'</span><span class='op'>)</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>18</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="err">�</span><span class="err">�</span><span class="err">�</span><span class="com"># A python source file in utf-8, with BOM</span><span class="strut"> </span></p> +<p id="t2" class="stm run hide_run"><span class="nam">math</span> <span class="op">=</span> <span class="str">"3×4 = 12, ÷2 = 6±0"</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">sys</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">if</span> <span class="nam">sys</span><span class="op">.</span><span class="nam">version_info</span> <span class="op">>=</span> <span class="op">(</span><span class="num">3</span><span class="op">,</span> <span class="num">0</span><span class="op">)</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t7" class="stm mis"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">math</span><span class="op">)</span> <span class="op">==</span> <span class="num">18</span><span class="strut"> </span></p> +<p id="t8" class="stm mis"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">math</span><span class="op">.</span><span class="nam">encode</span><span class="op">(</span><span class="str">'utf-8'</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="num">21</span><span class="strut"> </span></p> +<p id="t9" class="pln"><span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t10" class="stm run hide_run"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">math</span><span class="op">)</span> <span class="op">==</span> <span class="num">21</span><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"> <span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">math</span><span class="op">.</span><span class="nam">decode</span><span class="op">(</span><span class="str">'utf-8'</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="num">18</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="http://nedbatchelder.com/code/coverage/4.0a1">coverage.py v4.0a1</a> </p> </div> </div> diff --git a/tests/farm/html/gold_bom/index.html b/tests/farm/html/gold_bom/index.html index 525e7778..77696727 100644 --- a/tests/farm/html/gold_bom/index.html +++ b/tests/farm/html/gold_bom/index.html @@ -1,28 +1,28 @@ <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>71%</span> + <span class="pc_cov">71%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,54 +30,54 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>7</td> <td>2</td> <td>0</td> - <td class='right' data-ratio='5 7'>71%</td> + <td class="right" data-ratio="5 7">71%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='bom.html'>bom</a></td> + <tr class="file"> + <td class="name left"><a href="bom.html">bom</a></td> <td>7</td> <td>2</td> <td>0</td> - <td class='right' data-ratio='5 7'>71%</td> + <td class="right" data-ratio="5 7">71%</td> </tr> </tbody> @@ -88,10 +88,10 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="http://nedbatchelder.com/code/coverage/4.0a1">coverage.py v4.0a1</a> </p> </div> </div> diff --git a/tests/farm/html/gold_isolatin1/index.html b/tests/farm/html/gold_isolatin1/index.html index b111b86f..ff4d26f9 100644 --- a/tests/farm/html/gold_isolatin1/index.html +++ b/tests/farm/html/gold_isolatin1/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,54 +33,54 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='isolatin1.html'>isolatin1</a></td> + <tr class="file"> + <td class="name left"><a href="isolatin1_py.html">isolatin1.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> </tbody> @@ -88,10 +91,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_isolatin1/isolatin1_py.html b/tests/farm/html/gold_isolatin1/isolatin1_py.html index 0e4ac95a..3c9af361 100644 --- a/tests/farm/html/gold_isolatin1/isolatin1_py.html +++ b/tests/farm/html/gold_isolatin1/isolatin1_py.html @@ -1,92 +1,102 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for isolatin1: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for isolatin1.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>isolatin1</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>isolatin1.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='pln'><a href='#n3'>3</a></p> -<p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="pln"><a href="#n6">6</a></p> +<p id="n7" class="stm run hide_run"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A python source file in another encoding.</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='com'># -*- coding: iso8859-1 -*-</span><span class='strut'> </span></p> -<p id='t3' class='pln'><span class='strut'> </span></p> -<p id='t4' class='stm run hide_run'><span class='nam'>math</span> <span class='op'>=</span> <span class='str'>"3×4 = 12, ÷2 = 6±0"</span><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>len</span><span class='op'>(</span><span class='nam'>math</span><span class='op'>)</span> <span class='op'>==</span> <span class='num'>18</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># -*- coding: iso8859-1 -*-</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="com"># A Python source file in another encoding.</span><span class="strut"> </span></p> +<p id="t6" class="pln"><span class="strut"> </span></p> +<p id="t7" class="stm run hide_run"><span class="nam">math</span> <span class="op">=</span> <span class="str">"3×4 = 12, ÷2 = 6±0"</span><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="key">assert</span> <span class="nam">len</span><span class="op">(</span><span class="nam">math</span><span class="op">)</span> <span class="op">==</span> <span class="num">18</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_1/index.html b/tests/farm/html/gold_omit_1/index.html index 7cacebbd..95ec804f 100644 --- a/tests/farm/html/gold_omit_1/index.html +++ b/tests/farm/html/gold_omit_1/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,81 +33,81 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>14</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='14 14'>100%</td> + <td class="right" data-ratio="14 14">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='m1.html'>m1</a></td> + <tr class="file"> + <td class="name left"><a href="m1_py.html">m1.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='m2.html'>m2</a></td> + <tr class="file"> + <td class="name left"><a href="m2_py.html">m2.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='m3.html'>m3</a></td> + <tr class="file"> + <td class="name left"><a href="m3_py.html">m3.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='main.html'>main</a></td> + <tr class="file"> + <td class="name left"><a href="main_py.html">main.py</a></td> <td>8</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='8 8'>100%</td> + <td class="right" data-ratio="8 8">100%</td> </tr> </tbody> @@ -115,10 +118,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_1/m1_py.html b/tests/farm/html/gold_omit_1/m1_py.html index de44f789..8df0bf51 100644 --- a/tests/farm/html/gold_omit_1/m1_py.html +++ b/tests/farm/html/gold_omit_1/m1_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m1: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m1.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m1</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m1.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m1a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m1b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m1a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m1b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_1/m2_py.html b/tests/farm/html/gold_omit_1/m2_py.html index c775e6bb..2a7f13f0 100644 --- a/tests/farm/html/gold_omit_1/m2_py.html +++ b/tests/farm/html/gold_omit_1/m2_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m2: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m2.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m2</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m2.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m2a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m2b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m2a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m2b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_1/m3_py.html b/tests/farm/html/gold_omit_1/m3_py.html index 67354c48..b372a96e 100644 --- a/tests/farm/html/gold_omit_1/m3_py.html +++ b/tests/farm/html/gold_omit_1/m3_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m3: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m3.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m3</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m3.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m3a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m3b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m3a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m3b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_1/main_py.html b/tests/farm/html/gold_omit_1/main_py.html index a71b10e4..ba6e9680 100644 --- a/tests/farm/html/gold_omit_1/main_py.html +++ b/tests/farm/html/gold_omit_1/main_py.html @@ -1,102 +1,112 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for main: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for main.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>main</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>main.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m2</span><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='nam'>b</span> <span class='op'>=</span> <span class='num'>6</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m1</span><span class='op'>.</span><span class='nam'>m1a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m2</span><span class='op'>.</span><span class='nam'>m2a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m3</span><span class='op'>.</span><span class='nam'>m3a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">m1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="key">import</span> <span class="nam">m2</span><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">m3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"><span class="nam">b</span> <span class="op">=</span> <span class="num">6</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m1</span><span class="op">.</span><span class="nam">m1a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m2</span><span class="op">.</span><span class="nam">m2a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m3</span><span class="op">.</span><span class="nam">m3a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_2/index.html b/tests/farm/html/gold_omit_2/index.html index b6d495c8..fc781120 100644 --- a/tests/farm/html/gold_omit_2/index.html +++ b/tests/farm/html/gold_omit_2/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,72 +33,72 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>12</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='12 12'>100%</td> + <td class="right" data-ratio="12 12">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='m2.html'>m2</a></td> + <tr class="file"> + <td class="name left"><a href="m2_py.html">m2.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='m3.html'>m3</a></td> + <tr class="file"> + <td class="name left"><a href="m3_py.html">m3.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='main.html'>main</a></td> + <tr class="file"> + <td class="name left"><a href="main_py.html">main.py</a></td> <td>8</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='8 8'>100%</td> + <td class="right" data-ratio="8 8">100%</td> </tr> </tbody> @@ -106,10 +109,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_2/m2_py.html b/tests/farm/html/gold_omit_2/m2_py.html index c775e6bb..2a7f13f0 100644 --- a/tests/farm/html/gold_omit_2/m2_py.html +++ b/tests/farm/html/gold_omit_2/m2_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m2: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m2.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m2</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m2.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m2a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m2b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m2a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m2b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_2/m3_py.html b/tests/farm/html/gold_omit_2/m3_py.html index 67354c48..b372a96e 100644 --- a/tests/farm/html/gold_omit_2/m3_py.html +++ b/tests/farm/html/gold_omit_2/m3_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m3: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m3.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m3</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m3.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m3a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m3b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m3a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m3b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_2/main_py.html b/tests/farm/html/gold_omit_2/main_py.html index a71b10e4..ba6e9680 100644 --- a/tests/farm/html/gold_omit_2/main_py.html +++ b/tests/farm/html/gold_omit_2/main_py.html @@ -1,102 +1,112 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for main: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for main.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>main</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>main.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m2</span><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='nam'>b</span> <span class='op'>=</span> <span class='num'>6</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m1</span><span class='op'>.</span><span class='nam'>m1a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m2</span><span class='op'>.</span><span class='nam'>m2a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m3</span><span class='op'>.</span><span class='nam'>m3a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">m1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="key">import</span> <span class="nam">m2</span><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">m3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"><span class="nam">b</span> <span class="op">=</span> <span class="num">6</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m1</span><span class="op">.</span><span class="nam">m1a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m2</span><span class="op">.</span><span class="nam">m2a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m3</span><span class="op">.</span><span class="nam">m3a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_3/index.html b/tests/farm/html/gold_omit_3/index.html index db0ad581..cc9e9ea5 100644 --- a/tests/farm/html/gold_omit_3/index.html +++ b/tests/farm/html/gold_omit_3/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,63 +33,63 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>10</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='10 10'>100%</td> + <td class="right" data-ratio="10 10">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='m3.html'>m3</a></td> + <tr class="file"> + <td class="name left"><a href="m3_py.html">m3.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='main.html'>main</a></td> + <tr class="file"> + <td class="name left"><a href="main_py.html">main.py</a></td> <td>8</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='8 8'>100%</td> + <td class="right" data-ratio="8 8">100%</td> </tr> </tbody> @@ -97,10 +100,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_3/m3_py.html b/tests/farm/html/gold_omit_3/m3_py.html index 67354c48..b372a96e 100644 --- a/tests/farm/html/gold_omit_3/m3_py.html +++ b/tests/farm/html/gold_omit_3/m3_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m3: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m3.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m3</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m3.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m3a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m3b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m3a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m3b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_3/main_py.html b/tests/farm/html/gold_omit_3/main_py.html index a71b10e4..ba6e9680 100644 --- a/tests/farm/html/gold_omit_3/main_py.html +++ b/tests/farm/html/gold_omit_3/main_py.html @@ -1,102 +1,112 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for main: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for main.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>main</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>main.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m2</span><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='nam'>b</span> <span class='op'>=</span> <span class='num'>6</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m1</span><span class='op'>.</span><span class='nam'>m1a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m2</span><span class='op'>.</span><span class='nam'>m2a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m3</span><span class='op'>.</span><span class='nam'>m3a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">m1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="key">import</span> <span class="nam">m2</span><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">m3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"><span class="nam">b</span> <span class="op">=</span> <span class="num">6</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m1</span><span class="op">.</span><span class="nam">m1a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m2</span><span class="op">.</span><span class="nam">m2a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m3</span><span class="op">.</span><span class="nam">m3a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_4/index.html b/tests/farm/html/gold_omit_4/index.html index 130e2993..c0289fd5 100644 --- a/tests/farm/html/gold_omit_4/index.html +++ b/tests/farm/html/gold_omit_4/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,72 +33,72 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>12</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='12 12'>100%</td> + <td class="right" data-ratio="12 12">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='m1.html'>m1</a></td> + <tr class="file"> + <td class="name left"><a href="m1_py.html">m1.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='m3.html'>m3</a></td> + <tr class="file"> + <td class="name left"><a href="m3_py.html">m3.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='main.html'>main</a></td> + <tr class="file"> + <td class="name left"><a href="main_py.html">main.py</a></td> <td>8</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='8 8'>100%</td> + <td class="right" data-ratio="8 8">100%</td> </tr> </tbody> @@ -106,10 +109,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_4/m1_py.html b/tests/farm/html/gold_omit_4/m1_py.html index de44f789..8df0bf51 100644 --- a/tests/farm/html/gold_omit_4/m1_py.html +++ b/tests/farm/html/gold_omit_4/m1_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m1: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m1.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m1</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m1.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m1a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m1b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m1a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m1b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_4/m3_py.html b/tests/farm/html/gold_omit_4/m3_py.html index 67354c48..b372a96e 100644 --- a/tests/farm/html/gold_omit_4/m3_py.html +++ b/tests/farm/html/gold_omit_4/m3_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m3: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m3.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m3</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m3.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m3a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m3b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m3a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m3b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_4/main_py.html b/tests/farm/html/gold_omit_4/main_py.html index a71b10e4..ba6e9680 100644 --- a/tests/farm/html/gold_omit_4/main_py.html +++ b/tests/farm/html/gold_omit_4/main_py.html @@ -1,102 +1,112 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for main: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for main.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>main</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>main.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m2</span><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='nam'>b</span> <span class='op'>=</span> <span class='num'>6</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m1</span><span class='op'>.</span><span class='nam'>m1a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m2</span><span class='op'>.</span><span class='nam'>m2a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m3</span><span class='op'>.</span><span class='nam'>m3a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">m1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="key">import</span> <span class="nam">m2</span><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">m3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"><span class="nam">b</span> <span class="op">=</span> <span class="num">6</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m1</span><span class="op">.</span><span class="nam">m1a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m2</span><span class="op">.</span><span class="nam">m2a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m3</span><span class="op">.</span><span class="nam">m3a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_5/index.html b/tests/farm/html/gold_omit_5/index.html index 66306a29..5e9a2413 100644 --- a/tests/farm/html/gold_omit_5/index.html +++ b/tests/farm/html/gold_omit_5/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,63 +33,63 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>10</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='10 10'>100%</td> + <td class="right" data-ratio="10 10">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='m1.html'>m1</a></td> + <tr class="file"> + <td class="name left"><a href="m1_py.html">m1.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='main.html'>main</a></td> + <tr class="file"> + <td class="name left"><a href="main_py.html">main.py</a></td> <td>8</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='8 8'>100%</td> + <td class="right" data-ratio="8 8">100%</td> </tr> </tbody> @@ -97,10 +100,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_5/m1_py.html b/tests/farm/html/gold_omit_5/m1_py.html index de44f789..8df0bf51 100644 --- a/tests/farm/html/gold_omit_5/m1_py.html +++ b/tests/farm/html/gold_omit_5/m1_py.html @@ -1,86 +1,96 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for m1: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for m1.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>m1</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>m1.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='nam'>m1a</span> <span class='op'>=</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='nam'>m1b</span> <span class='op'>=</span> <span class='num'>2</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="nam">m1a</span> <span class="op">=</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="nam">m1b</span> <span class="op">=</span> <span class="num">2</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_omit_5/main_py.html b/tests/farm/html/gold_omit_5/main_py.html index a71b10e4..ba6e9680 100644 --- a/tests/farm/html/gold_omit_5/main_py.html +++ b/tests/farm/html/gold_omit_5/main_py.html @@ -1,102 +1,112 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for main: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for main.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>main</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>main.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='stm run hide_run'><a href='#n1'>1</a></p> -<p id='n2' class='stm run hide_run'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='stm run hide_run'><a href='#n10'>10</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="stm run hide_run"><a href="#n4">4</a></p> +<p id="n5" class="stm run hide_run"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="stm run hide_run"><a href="#n13">13</a></p> </td> - <td class='text'> -<p id='t1' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m1</span><span class='strut'> </span></p> -<p id='t2' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m2</span><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>m3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>5</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'><span class='nam'>b</span> <span class='op'>=</span> <span class='num'>6</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m1</span><span class='op'>.</span><span class='nam'>m1a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m2</span><span class='op'>.</span><span class='nam'>m2a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> -<p id='t10' class='stm run hide_run'><span class='key'>assert</span> <span class='nam'>m3</span><span class='op'>.</span><span class='nam'>m3a</span> <span class='op'>==</span> <span class='num'>1</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="stm run hide_run"><span class="key">import</span> <span class="nam">m1</span><span class="strut"> </span></p> +<p id="t5" class="stm run hide_run"><span class="key">import</span> <span class="nam">m2</span><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">m3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">5</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"><span class="nam">b</span> <span class="op">=</span> <span class="num">6</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m1</span><span class="op">.</span><span class="nam">m1a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m2</span><span class="op">.</span><span class="nam">m2a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> +<p id="t13" class="stm run hide_run"><span class="key">assert</span> <span class="nam">m3</span><span class="op">.</span><span class="nam">m3a</span> <span class="op">==</span> <span class="num">1</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_other/blah_blah_other_py.html b/tests/farm/html/gold_other/blah_blah_other_py.html index f070f3ef..51b7708e 100644 --- a/tests/farm/html/gold_other/blah_blah_other_py.html +++ b/tests/farm/html/gold_other/blah_blah_other_py.html @@ -1,90 +1,100 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for /Users/ned/coverage/trunk/tests/farm/html/othersrc/other: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for /Users/ned/coverage/trunk/tests/farm/html/othersrc/other.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>/Users/ned/coverage/trunk/tests/farm/html/othersrc/other</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>/Users/ned/coverage/trunk/tests/farm/html/othersrc/other.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 1 statements - <span class='run hide_run shortkey_r button_toggle_run'>1 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">1 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='pln'><a href='#n3'>3</a></p> -<p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="pln"><a href="#n6">6</a></p> +<p id="n7" class="stm run hide_run"><a href="#n7">7</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A file in another directory. We're checking that it ends up in the</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='com'># HTML report.</span><span class='strut'> </span></p> -<p id='t3' class='pln'><span class='strut'> </span></p> -<p id='t4' class='stm run hide_run'><span class='key'>print</span><span class='op'>(</span><span class='str'>"This is the other src!"</span><span class='op'>)</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># A file in another directory. We're checking that it ends up in the</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="com"># HTML report.</span><span class="strut"> </span></p> +<p id="t6" class="pln"><span class="strut"> </span></p> +<p id="t7" class="stm run hide_run"><span class="key">print</span><span class="op">(</span><span class="str">"This is the other src!"</span><span class="op">)</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_other/here_py.html b/tests/farm/html/gold_other/here_py.html index e091395a..36310f5b 100644 --- a/tests/farm/html/gold_other/here_py.html +++ b/tests/farm/html/gold_other/here_py.html @@ -1,98 +1,108 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for here: 75%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for here.py: 75%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>here</b> : - <span class='pc_cov'>75%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>here.py</b> : + <span class="pc_cov">75%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 4 statements - <span class='run hide_run shortkey_r button_toggle_run'>3 run</span> - <span class='mis shortkey_m button_toggle_mis'>1 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">3 run</span> + <span class="mis shortkey_m button_toggle_mis">1 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm mis'><a href='#n8'>8</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm mis"><a href="#n11">11</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>import</span> <span class='nam'>other</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='key'>if</span> <span class='num'>1</span> <span class='op'><</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'> <span class='nam'>h</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t8' class='stm mis'> <span class='nam'>h</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># A test file for HTML reporting by coverage.py.</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">import</span> <span class="nam">other</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="key">if</span> <span class="num">1</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"> <span class="nam">h</span> <span class="op">=</span> <span class="num">3</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t11" class="stm mis"> <span class="nam">h</span> <span class="op">=</span> <span class="num">4</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_other/index.html b/tests/farm/html/gold_other/index.html index a27295c4..25d437e9 100644 --- a/tests/farm/html/gold_other/index.html +++ b/tests/farm/html/gold_other/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>80%</span> + <span class="pc_cov">80%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,63 +33,63 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>5</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='4 5'>80%</td> + <td class="right" data-ratio="4 5">80%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='_Users_ned_coverage_trunk_tests_farm_html_othersrc_other.html'>/Users/ned/coverage/trunk/tests/farm/html/othersrc/other</a></td> + <tr class="file"> + <td class="name left"><a href="_Users_ned_coverage_trunk_tests_farm_html_othersrc_other_py.html">/Users/ned/coverage/trunk/tests/farm/html/othersrc/other.py</a></td> <td>1</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='1 1'>100%</td> + <td class="right" data-ratio="1 1">100%</td> </tr> - <tr class='file'> - <td class='name left'><a href='here.html'>here</a></td> + <tr class="file"> + <td class="name left"><a href="here_py.html">here.py</a></td> <td>4</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='3 4'>75%</td> + <td class="right" data-ratio="3 4">75%</td> </tr> </tbody> @@ -97,10 +100,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_partial/index.html b/tests/farm/html/gold_partial/index.html index 5445d769..506d80d4 100644 --- a/tests/farm/html/gold_partial/index.html +++ b/tests/farm/html/gold_partial/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,44 +33,44 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>b</span> - <span class='key'>p</span> + <span class="key">b</span> + <span class="key">p</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='shortkey_b'>branches</th> - <th class='shortkey_p'>partial</th> + <th class="shortkey_b">branches</th> + <th class="shortkey_p">partial</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>8</td> <td>0</td> <td>0</td> @@ -75,13 +78,13 @@ <td>4</td> <td>0</td> - <td class='right' data-ratio='12 12'>100%</td> + <td class="right" data-ratio="12 12">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='partial.html'>partial</a></td> + <tr class="file"> + <td class="name left"><a href="partial_py.html">partial.py</a></td> <td>8</td> <td>0</td> <td>0</td> @@ -89,7 +92,7 @@ <td>4</td> <td>0</td> - <td class='right' data-ratio='12 12'>100%</td> + <td class="right" data-ratio="12 12">100%</td> </tr> </tbody> @@ -100,10 +103,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_partial/partial_py.html b/tests/farm/html/gold_partial/partial_py.html index 64dfacfa..53997f57 100644 --- a/tests/farm/html/gold_partial/partial_py.html +++ b/tests/farm/html/gold_partial/partial_py.html @@ -1,120 +1,130 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for partial: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for partial.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>partial</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>partial.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 8 statements - <span class='run hide_run shortkey_r button_toggle_run'>8 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">8 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> - <span class='par run hide_run shortkey_p button_toggle_par'>0 partial</span> + <span class="par run hide_run shortkey_p button_toggle_par">0 partial</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='stm run hide_run'><a href='#n6'>6</a></p> -<p id='n7' class='pln'><a href='#n7'>7</a></p> -<p id='n8' class='stm run hide_run'><a href='#n8'>8</a></p> -<p id='n9' class='stm run hide_run'><a href='#n9'>9</a></p> -<p id='n10' class='pln'><a href='#n10'>10</a></p> -<p id='n11' class='stm run hide_run'><a href='#n11'>11</a></p> -<p id='n12' class='stm run hide_run'><a href='#n12'>12</a></p> -<p id='n13' class='pln'><a href='#n13'>13</a></p> -<p id='n14' class='pln'><a href='#n14'>14</a></p> -<p id='n15' class='pln'><a href='#n15'>15</a></p> -<p id='n16' class='pln'><a href='#n16'>16</a></p> -<p id='n17' class='pln'><a href='#n17'>17</a></p> -<p id='n18' class='stm run hide_run'><a href='#n18'>18</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="stm run hide_run"><a href="#n9">9</a></p> +<p id="n10" class="pln"><a href="#n10">10</a></p> +<p id="n11" class="stm run hide_run"><a href="#n11">11</a></p> +<p id="n12" class="stm run hide_run"><a href="#n12">12</a></p> +<p id="n13" class="pln"><a href="#n13">13</a></p> +<p id="n14" class="stm run hide_run"><a href="#n14">14</a></p> +<p id="n15" class="stm run hide_run"><a href="#n15">15</a></p> +<p id="n16" class="pln"><a href="#n16">16</a></p> +<p id="n17" class="pln"><a href="#n17">17</a></p> +<p id="n18" class="pln"><a href="#n18">18</a></p> +<p id="n19" class="pln"><a href="#n19">19</a></p> +<p id="n20" class="pln"><a href="#n20">20</a></p> +<p id="n21" class="stm run hide_run"><a href="#n21">21</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># partial branches</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'> </span></p> -<p id='t4' class='pln'><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='key'>while</span> <span class='nam'>True</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t6' class='stm run hide_run'> <span class='key'>break</span><span class='strut'> </span></p> -<p id='t7' class='pln'><span class='strut'> </span></p> -<p id='t8' class='stm run hide_run'><span class='key'>while</span> <span class='num'>1</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t9' class='stm run hide_run'> <span class='key'>break</span><span class='strut'> </span></p> -<p id='t10' class='pln'><span class='strut'> </span></p> -<p id='t11' class='stm run hide_run'><span class='key'>while</span> <span class='nam'>a</span><span class='op'>:</span> <span class='com'># pragma: no branch</span><span class='strut'> </span></p> -<p id='t12' class='stm run hide_run'> <span class='key'>break</span><span class='strut'> </span></p> -<p id='t13' class='pln'><span class='strut'> </span></p> -<p id='t14' class='pln'><span class='key'>if</span> <span class='num'>0</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t15' class='pln'> <span class='nam'>never_happen</span><span class='op'>(</span><span class='op'>)</span><span class='strut'> </span></p> -<p id='t16' class='pln'><span class='strut'> </span></p> -<p id='t17' class='pln'><span class='key'>if</span> <span class='num'>1</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t18' class='stm run hide_run'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>13</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># partial branches</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="nam">a</span> <span class="op">=</span> <span class="num">3</span><span class="strut"> </span></p> +<p id="t7" class="pln"><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="key">while</span> <span class="nam">True</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t9" class="stm run hide_run"> <span class="key">break</span><span class="strut"> </span></p> +<p id="t10" class="pln"><span class="strut"> </span></p> +<p id="t11" class="stm run hide_run"><span class="key">while</span> <span class="num">1</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t12" class="stm run hide_run"> <span class="key">break</span><span class="strut"> </span></p> +<p id="t13" class="pln"><span class="strut"> </span></p> +<p id="t14" class="stm run hide_run"><span class="key">while</span> <span class="nam">a</span><span class="op">:</span> <span class="com"># pragma: no branch</span><span class="strut"> </span></p> +<p id="t15" class="stm run hide_run"> <span class="key">break</span><span class="strut"> </span></p> +<p id="t16" class="pln"><span class="strut"> </span></p> +<p id="t17" class="pln"><span class="key">if</span> <span class="num">0</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t18" class="pln"> <span class="nam">never_happen</span><span class="op">(</span><span class="op">)</span><span class="strut"> </span></p> +<p id="t19" class="pln"><span class="strut"> </span></p> +<p id="t20" class="pln"><span class="key">if</span> <span class="num">1</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t21" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">13</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_styled/a_py.html b/tests/farm/html/gold_styled/a_py.html index 9fdaee17..890a8268 100644 --- a/tests/farm/html/gold_styled/a_py.html +++ b/tests/farm/html/gold_styled/a_py.html @@ -1,98 +1,108 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for a: 67%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for a.py: 67%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <link rel='stylesheet' href='extra.css' type='text/css'> + <link rel="stylesheet" href="extra.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>a</b> : - <span class='pc_cov'>67%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>a.py</b> : + <span class="pc_cov">67%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 3 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>1 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">1 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='stm run hide_run'><a href='#n3'>3</a></p> -<p id='n4' class='pln'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> -<p id='n6' class='pln'><a href='#n6'>6</a></p> -<p id='n7' class='stm mis'><a href='#n7'>7</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="stm run hide_run"><a href="#n6">6</a></p> +<p id="n7" class="pln"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> +<p id="n9" class="pln"><a href="#n9">9</a></p> +<p id="n10" class="stm mis"><a href="#n10">10</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A test file for HTML reporting by coverage.</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='strut'> </span></p> -<p id='t3' class='stm run hide_run'><span class='key'>if</span> <span class='num'>1</span> <span class='op'><</span> <span class='num'>2</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t4' class='pln'> <span class='com'># Needed a < to look at HTML entities.</span><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span><span class='strut'> </span></p> -<p id='t6' class='pln'><span class='key'>else</span><span class='op'>:</span><span class='strut'> </span></p> -<p id='t7' class='stm mis'> <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>4</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="com"># A test file for HTML reporting by coverage.py.</span><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="strut"> </span></p> +<p id="t6" class="stm run hide_run"><span class="key">if</span> <span class="num">1</span> <span class="op"><</span> <span class="num">2</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t7" class="pln"> <span class="com"># Needed a < to look at HTML entities.</span><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"> <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span><span class="strut"> </span></p> +<p id="t9" class="pln"><span class="key">else</span><span class="op">:</span><span class="strut"> </span></p> +<p id="t10" class="stm mis"> <span class="nam">a</span> <span class="op">=</span> <span class="num">4</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_styled/index.html b/tests/farm/html/gold_styled/index.html index 87a8c3db..7209b64a 100644 --- a/tests/farm/html/gold_styled/index.html +++ b/tests/farm/html/gold_styled/index.html @@ -1,30 +1,33 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <link rel='stylesheet' href='extra.css' type='text/css'> + <link rel="stylesheet" href="extra.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>67%</span> + <span class="pc_cov">67%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -32,54 +35,54 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>3</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='2 3'>67%</td> + <td class="right" data-ratio="2 3">67%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='a.html'>a</a></td> + <tr class="file"> + <td class="name left"><a href="a_py.html">a.py</a></td> <td>3</td> <td>1</td> <td>0</td> - <td class='right' data-ratio='2 3'>67%</td> + <td class="right" data-ratio="2 3">67%</td> </tr> </tbody> @@ -90,10 +93,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_styled/style.css b/tests/farm/html/gold_styled/style.css index 038335c1..2dfb8f65 100644 --- a/tests/farm/html/gold_styled/style.css +++ b/tests/farm/html/gold_styled/style.css @@ -1,4 +1,7 @@ -/* CSS styles for Coverage. */ +/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ +/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ + +/* CSS styles for coverage.py. */ /* Page-wide styles */ html, body, h1, h2, h3, p, table, td, th { margin: 0; diff --git a/tests/farm/html/gold_unicode/index.html b/tests/farm/html/gold_unicode/index.html index dae53ea0..58529525 100644 --- a/tests/farm/html/gold_unicode/index.html +++ b/tests/farm/html/gold_unicode/index.html @@ -1,28 +1,31 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Coverage report</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.debounce.min.js'></script> - <script type='text/javascript' src='jquery.tablesorter.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.debounce.min.js"></script> + <script type="text/javascript" src="jquery.tablesorter.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.index_ready); </script> </head> -<body class='indexfile'> +<body class="indexfile"> -<div id='header'> - <div class='content'> +<div id="header"> + <div class="content"> <h1>Coverage report: - <span class='pc_cov'>100%</span> + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> <form id="filter_container"> <input id="filter" type="text" value="" placeholder="filter..." /> @@ -30,54 +33,54 @@ </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> - <p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> + <p class="legend">Hot-keys on this page</p> <div> - <p class='keyhelp'> - <span class='key'>n</span> - <span class='key'>s</span> - <span class='key'>m</span> - <span class='key'>x</span> + <p class="keyhelp"> + <span class="key">n</span> + <span class="key">s</span> + <span class="key">m</span> + <span class="key">x</span> - <span class='key'>c</span> change column sorting + <span class="key">c</span> change column sorting </p> </div> </div> -<div id='index'> - <table class='index'> +<div id="index"> + <table class="index"> <thead> - <tr class='tablehead' title='Click to sort'> - <th class='name left headerSortDown shortkey_n'>Module</th> - <th class='shortkey_s'>statements</th> - <th class='shortkey_m'>missing</th> - <th class='shortkey_x'>excluded</th> + <tr class="tablehead" title="Click to sort"> + <th class="name left headerSortDown shortkey_n">Module</th> + <th class="shortkey_s">statements</th> + <th class="shortkey_m">missing</th> + <th class="shortkey_x">excluded</th> - <th class='right shortkey_c'>coverage</th> + <th class="right shortkey_c">coverage</th> </tr> </thead> <tfoot> - <tr class='total'> - <td class='name left'>Total</td> + <tr class="total"> + <td class="name left">Total</td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> </tfoot> <tbody> - <tr class='file'> - <td class='name left'><a href='unicode.html'>unicode</a></td> + <tr class="file"> + <td class="name left"><a href="unicode_py.html">unicode.py</a></td> <td>2</td> <td>0</td> <td>0</td> - <td class='right' data-ratio='2 2'>100%</td> + <td class="right" data-ratio="2 2">100%</td> </tr> </tbody> @@ -88,10 +91,11 @@ </p> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:31 </p> </div> </div> diff --git a/tests/farm/html/gold_unicode/unicode_py.html b/tests/farm/html/gold_unicode/unicode_py.html index d67af56d..d0d58afc 100644 --- a/tests/farm/html/gold_unicode/unicode_py.html +++ b/tests/farm/html/gold_unicode/unicode_py.html @@ -1,92 +1,102 @@ + + + <!DOCTYPE html> <html> <head> - <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' /> - <title>Coverage for unicode: 100%</title> - <link rel='stylesheet' href='style.css' type='text/css'> + <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7" /> + <title>Coverage for unicode.py: 100%</title> + <link rel="stylesheet" href="style.css" type="text/css"> - <script type='text/javascript' src='jquery.min.js'></script> - <script type='text/javascript' src='jquery.hotkeys.js'></script> - <script type='text/javascript' src='jquery.isonscreen.js'></script> - <script type='text/javascript' src='coverage_html.js'></script> - <script type='text/javascript'> + <script type="text/javascript" src="jquery.min.js"></script> + <script type="text/javascript" src="jquery.hotkeys.js"></script> + <script type="text/javascript" src="jquery.isonscreen.js"></script> + <script type="text/javascript" src="coverage_html.js"></script> + <script type="text/javascript"> jQuery(document).ready(coverage.pyfile_ready); </script> </head> -<body class='pyfile'> +<body class="pyfile"> -<div id='header'> - <div class='content'> - <h1>Coverage for <b>unicode</b> : - <span class='pc_cov'>100%</span> +<div id="header"> + <div class="content"> + <h1>Coverage for <b>unicode.py</b> : + <span class="pc_cov">100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png' alt='Show keyboard shortcuts' /> + <img id="keyboard_icon" src="keybd_closed.png" alt="Show keyboard shortcuts" /> - <h2 class='stats'> + <h2 class="stats"> 2 statements - <span class='run hide_run shortkey_r button_toggle_run'>2 run</span> - <span class='mis shortkey_m button_toggle_mis'>0 missing</span> - <span class='exc shortkey_x button_toggle_exc'>0 excluded</span> + <span class="run hide_run shortkey_r button_toggle_run">2 run</span> + <span class="mis shortkey_m button_toggle_mis">0 missing</span> + <span class="exc shortkey_x button_toggle_exc">0 excluded</span> </h2> </div> </div> -<div class='help_panel'> - <img id='panel_icon' src='keybd_open.png' alt='Hide keyboard shortcuts' /> -<p class='legend'>Hot-keys on this page</p> +<div class="help_panel"> + <img id="panel_icon" src="keybd_open.png" alt="Hide keyboard shortcuts" /> +<p class="legend">Hot-keys on this page</p> <div> -<p class='keyhelp'> - <span class='key'>r</span> - <span class='key'>m</span> - <span class='key'>x</span> - <span class='key'>p</span> toggle line displays +<p class="keyhelp"> + <span class="key">r</span> + <span class="key">m</span> + <span class="key">x</span> + <span class="key">p</span> toggle line displays </p> -<p class='keyhelp'> - <span class='key'>j</span> - <span class='key'>k</span> next/prev highlighted chunk +<p class="keyhelp"> + <span class="key">j</span> + <span class="key">k</span> next/prev highlighted chunk </p> -<p class='keyhelp'> - <span class='key'>0</span> (zero) top of page +<p class="keyhelp"> + <span class="key">0</span> (zero) top of page </p> -<p class='keyhelp'> - <span class='key'>1</span> (one) first highlighted chunk +<p class="keyhelp"> + <span class="key">1</span> (one) first highlighted chunk </p> </div> </div> -<div id='source'> +<div id="source"> <table> <tr> - <td class='linenos'> -<p id='n1' class='pln'><a href='#n1'>1</a></p> -<p id='n2' class='pln'><a href='#n2'>2</a></p> -<p id='n3' class='pln'><a href='#n3'>3</a></p> -<p id='n4' class='stm run hide_run'><a href='#n4'>4</a></p> -<p id='n5' class='stm run hide_run'><a href='#n5'>5</a></p> + <td class="linenos"> +<p id="n1" class="pln"><a href="#n1">1</a></p> +<p id="n2" class="pln"><a href="#n2">2</a></p> +<p id="n3" class="pln"><a href="#n3">3</a></p> +<p id="n4" class="pln"><a href="#n4">4</a></p> +<p id="n5" class="pln"><a href="#n5">5</a></p> +<p id="n6" class="pln"><a href="#n6">6</a></p> +<p id="n7" class="stm run hide_run"><a href="#n7">7</a></p> +<p id="n8" class="stm run hide_run"><a href="#n8">8</a></p> </td> - <td class='text'> -<p id='t1' class='pln'><span class='com'># A python source file with exotic characters</span><span class='strut'> </span></p> -<p id='t2' class='pln'><span class='com'># -*- coding: utf-8 -*-</span><span class='strut'> </span></p> -<p id='t3' class='pln'><span class='strut'> </span></p> -<p id='t4' class='stm run hide_run'><span class='nam'>upside_down</span> <span class='op'>=</span> <span class='str'>"ʎd˙ǝbɐɹǝʌoɔ"</span><span class='strut'> </span></p> -<p id='t5' class='stm run hide_run'><span class='nam'>surrogate</span> <span class='op'>=</span> <span class='str'>"db40,dd00: x󠄀"</span><span class='strut'> </span></p> + <td class="text"> +<p id="t1" class="pln"><span class="com"># -*- coding: utf-8 -*-</span><span class="strut"> </span></p> +<p id="t2" class="pln"><span class="com"># Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0</span><span class="strut"> </span></p> +<p id="t3" class="pln"><span class="com"># For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt</span><span class="strut"> </span></p> +<p id="t4" class="pln"><span class="strut"> </span></p> +<p id="t5" class="pln"><span class="com"># A Python source file with exotic characters.</span><span class="strut"> </span></p> +<p id="t6" class="pln"><span class="strut"> </span></p> +<p id="t7" class="stm run hide_run"><span class="nam">upside_down</span> <span class="op">=</span> <span class="str">"ʎd˙ǝbɐɹǝʌoɔ"</span><span class="strut"> </span></p> +<p id="t8" class="stm run hide_run"><span class="nam">surrogate</span> <span class="op">=</span> <span class="str">"db40,dd00: x󠄀"</span><span class="strut"> </span></p> </td> </tr> </table> </div> -<div id='footer'> - <div class='content'> +<div id="footer"> + <div class="content"> <p> - <a class='nav' href='index.html'>« index</a> <a class='nav' href='http://nedbatchelder.com/code/coverage/4.0a1'>coverage.py v4.0a1</a> + <a class="nav" href="index.html">« index</a> <a class="nav" href="https://coverage.readthedocs.org/en/coverage-4.0a7">coverage.py v4.0a7</a>, + created at 2015-07-24 09:04 </p> </div> </div> diff --git a/tests/farm/html/gold_x_xml/coverage.xml b/tests/farm/html/gold_x_xml/coverage.xml index 1511ae89..487e850d 100644 --- a/tests/farm/html/gold_x_xml/coverage.xml +++ b/tests/farm/html/gold_x_xml/coverage.xml @@ -1,23 +1,22 @@ -<?xml version="1.0" ?>
-<!DOCTYPE coverage
- SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
-<coverage branch-rate="0" line-rate="0.6667" timestamp="1253972570431" version="3.1b1">
- <!-- Generated by coverage.py: https://coverage.readthedocs.org/VER -->
- <sources>
- <source></source>
- </sources>
- <packages>
- <package branch-rate="0" complexity="0" line-rate="0.6667" name=".">
- <classes>
- <class branch-rate="0" complexity="0" filename="a.py" line-rate="0.6667" name="a.py">
- <methods/>
- <lines>
- <line hits="1" number="3"/>
- <line hits="1" number="5"/>
- <line hits="0" number="7"/>
- </lines>
- </class>
- </classes>
- </package>
- </packages>
-</coverage>
+<?xml version="1.0" ?> +<coverage branch-rate="0" line-rate="0.6667" timestamp="1437745880639" version="4.0a7"> + <!-- Generated by coverage.py: https://coverage.readthedocs.org/en/coverage-4.0a7 --> + <!-- Based on https://raw.githubusercontent.com/cobertura/web/f0366e5e2cf18f111cbd61fc34ef720a6584ba02/htdocs/xml/coverage-03.dtd --> + <sources> + <source>/Users/ned/coverage/trunk/tests/farm/html/src</source> + </sources> + <packages> + <package branch-rate="0" complexity="0" line-rate="0.6667" name="."> + <classes> + <class branch-rate="0" complexity="0" filename="a.py" line-rate="0.6667" name="a.py"> + <methods/> + <lines> + <line hits="1" number="6"/> + <line hits="1" number="8"/> + <line hits="0" number="10"/> + </lines> + </class> + </classes> + </package> + </packages> +</coverage> diff --git a/tests/farm/html/gold_y_xml_branch/coverage.xml b/tests/farm/html/gold_y_xml_branch/coverage.xml index 8e098fe8..a6acbfa1 100644 --- a/tests/farm/html/gold_y_xml_branch/coverage.xml +++ b/tests/farm/html/gold_y_xml_branch/coverage.xml @@ -1,25 +1,24 @@ -<?xml version="1.0" ?>
-<!DOCTYPE coverage
- SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
-<coverage branch-rate="0.5" line-rate="0.8" timestamp="1259288252325" version="3.2b4">
- <!-- Generated by coverage.py: https://coverage.readthedocs.org/VER -->
- <sources>
- <source></source>
- </sources>
- <packages>
- <package branch-rate="0.5" complexity="0" line-rate="0.8" name=".">
- <classes>
- <class branch-rate="0.5" complexity="0" filename="y.py" line-rate="0.8" name="y.py">
- <methods/>
- <lines>
- <line hits="1" number="3"/>
- <line branch="true" condition-coverage="50% (1/2)" hits="1" number="4"/>
- <line hits="1" number="5"/>
- <line hits="0" number="7"/>
- <line hits="1" number="9"/>
- </lines>
- </class>
- </classes>
- </package>
- </packages>
-</coverage>
+<?xml version="1.0" ?> +<coverage branch-rate="0.5" line-rate="0.8" timestamp="1437745880882" version="4.0a7"> + <!-- Generated by coverage.py: https://coverage.readthedocs.org/en/coverage-4.0a7 --> + <!-- Based on https://raw.githubusercontent.com/cobertura/web/f0366e5e2cf18f111cbd61fc34ef720a6584ba02/htdocs/xml/coverage-03.dtd --> + <sources> + <source>/Users/ned/coverage/trunk/tests/farm/html/src</source> + </sources> + <packages> + <package branch-rate="0.5" complexity="0" line-rate="0.8" name="."> + <classes> + <class branch-rate="0.5" complexity="0" filename="y.py" line-rate="0.8" name="y.py"> + <methods/> + <lines> + <line hits="1" number="6"/> + <line branch="true" condition-coverage="50% (1/2)" hits="1" missing-branches="10" number="7"/> + <line hits="1" number="8"/> + <line hits="0" number="10"/> + <line hits="1" number="12"/> + </lines> + </class> + </classes> + </package> + </packages> +</coverage> diff --git a/tests/farm/html/othersrc/other.py b/tests/farm/html/othersrc/other.py index 6d3f86e7..bf0304d2 100644 --- a/tests/farm/html/othersrc/other.py +++ b/tests/farm/html/othersrc/other.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # A file in another directory. We're checking that it ends up in the # HTML report. diff --git a/tests/farm/html/run_a.py b/tests/farm/html/run_a.py index 7963d2e5..1ec6220f 100644 --- a/tests/farm/html/run_a.py +++ b/tests/farm/html/run_a.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for a.""" + """Run coverage.py and make an HTML report for a.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import a # pragma: nested cov.stop() # pragma: nested @@ -13,14 +16,14 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_a", "html_a", size_within=10, file_pattern="*.html") contains("html_a/a_py.html", - "<span class='key'>if</span> <span class='num'>1</span> <span class='op'><</span> <span class='num'>2</span>", - " <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span>", - "<span class='pc_cov'>67%</span>" + '<span class="key">if</span> <span class="num">1</span> <span class="op"><</span> <span class="num">2</span>', + ' <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span>', + '<span class="pc_cov">67%</span>' ) contains("html_a/index.html", - "<a href='a_py.html'>a.py</a>", - "<span class='pc_cov'>67%</span>", - "<td class='right' data-ratio='2 3'>67%</td>", + '<a href="a_py.html">a.py</a>', + '<span class="pc_cov">67%</span>', + '<td class="right" data-ratio="2 3">67%</td>', ) clean("html_a") diff --git a/tests/farm/html/run_a_xml_1.py b/tests/farm/html/run_a_xml_1.py index 593beae2..e1bf1828 100644 --- a/tests/farm/html/run_a_xml_1.py +++ b/tests/farm/html/run_a_xml_1.py @@ -1,15 +1,18 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + source_path = None def html_it(): - """Run coverage and make an XML report for a.""" - import coverage - cov = coverage.coverage() + """Run coverage.py and make an XML report for a.""" + import coverage, coverage.files + cov = coverage.Coverage() cov.start() import a # pragma: nested cov.stop() # pragma: nested cov.xml_report(a, outfile="../xml_1/coverage.xml") global source_path - source_path = cov.file_locator.relative_dir.rstrip('/') + source_path = coverage.files.relative_directory().rstrip('/') import os if not os.path.exists("xml_1"): diff --git a/tests/farm/html/run_a_xml_2.py b/tests/farm/html/run_a_xml_2.py index 4d691b3b..f53e04aa 100644 --- a/tests/farm/html/run_a_xml_2.py +++ b/tests/farm/html/run_a_xml_2.py @@ -1,15 +1,18 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + source_path = None def html_it(): - """Run coverage and make an XML report for a.""" - import coverage - cov = coverage.coverage(config_file="run_a_xml_2.ini") + """Run coverage.py and make an XML report for a.""" + import coverage, coverage.files + cov = coverage.Coverage(config_file="run_a_xml_2.ini") cov.start() import a # pragma: nested cov.stop() # pragma: nested cov.xml_report(a) global source_path - source_path = cov.file_locator.relative_dir.rstrip('/') + source_path = coverage.files.relative_directory().rstrip('/') import os if not os.path.exists("xml_2"): diff --git a/tests/farm/html/run_b_branch.py b/tests/farm/html/run_b_branch.py index c92252ce..2451f069 100644 --- a/tests/farm/html/run_b_branch.py +++ b/tests/farm/html/run_b_branch.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage with branches and make an HTML report for b.""" + """Run coverage.py with branches and make an HTML report for b.""" import coverage - cov = coverage.coverage(branch=True) + cov = coverage.Coverage(branch=True) cov.start() import b # pragma: nested cov.stop() # pragma: nested @@ -13,17 +16,17 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_b_branch", "html_b_branch", size_within=10, file_pattern="*.html") contains("html_b_branch/b_py.html", - "<span class='key'>if</span> <span class='nam'>x</span> <span class='op'><</span> <span class='num'>2</span>", - " <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span>", - "<span class='pc_cov'>70%</span>", - "<span class='annotate' title='no jump to this line number'>8</span>", - "<span class='annotate' title='no jump to this line number'>exit</span>", - "<span class='annotate' title='no jumps to these line numbers'>23 25</span>", + '<span class="key">if</span> <span class="nam">x</span> <span class="op"><</span> <span class="num">2</span>', + ' <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span>', + '<span class="pc_cov">70%</span>', + '<span class="annotate" title="no jump to this line number">11</span>', + '<span class="annotate" title="no jump to this line number">exit</span>', + '<span class="annotate" title="no jumps to these line numbers">26 28</span>', ) contains("html_b_branch/index.html", - "<a href='b_py.html'>b.py</a>", - "<span class='pc_cov'>70%</span>", - "<td class='right' data-ratio='16 23'>70%</td>", + '<a href="b_py.html">b.py</a>', + '<span class="pc_cov">70%</span>', + '<td class="right" data-ratio="16 23">70%</td>', ) clean("html_b_branch") diff --git a/tests/farm/html/run_bom.py b/tests/farm/html/run_bom.py index 96949756..a34fab9f 100644 --- a/tests/farm/html/run_bom.py +++ b/tests/farm/html/run_bom.py @@ -1,9 +1,12 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import sys def html_it(): - """Run coverage and make an HTML report for bom.py.""" + """Run coverage.py and make an HTML report for bom.py.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import bom # pragma: nested cov.stop() # pragma: nested @@ -15,7 +18,7 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_bom", "html_bom", size_within=10, file_pattern="*.html") contains("html_bom/bom_py.html", - "<span class='str'>"3×4 = 12, ÷2 = 6±0"</span>", + '<span class="str">"3×4 = 12, ÷2 = 6±0"</span>', ) clean("html_bom") diff --git a/tests/farm/html/run_isolatin1.py b/tests/farm/html/run_isolatin1.py index bf3746d2..6729a275 100644 --- a/tests/farm/html/run_isolatin1.py +++ b/tests/farm/html/run_isolatin1.py @@ -1,9 +1,12 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import sys def html_it(): - """Run coverage and make an HTML report for isolatin1.py.""" + """Run coverage.py and make an HTML report for isolatin1.py.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import isolatin1 # pragma: nested cov.stop() # pragma: nested @@ -15,7 +18,7 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_isolatin1", "html_isolatin1", size_within=10, file_pattern="*.html") contains("html_isolatin1/isolatin1_py.html", - "<span class='str'>"3×4 = 12, ÷2 = 6±0"</span>", + '<span class="str">"3×4 = 12, ÷2 = 6±0"</span>', ) clean("html_isolatin1") diff --git a/tests/farm/html/run_omit_1.py b/tests/farm/html/run_omit_1.py index 102aeb2a..137d37ca 100644 --- a/tests/farm/html/run_omit_1.py +++ b/tests/farm/html/run_omit_1.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for main.""" + """Run coverage.py and make an HTML report for main.""" import coverage - cov = coverage.coverage(include=["./*"]) + cov = coverage.Coverage(include=["./*"]) cov.start() import main # pragma: nested cov.stop() # pragma: nested diff --git a/tests/farm/html/run_omit_2.py b/tests/farm/html/run_omit_2.py index a149c518..dd021b96 100644 --- a/tests/farm/html/run_omit_2.py +++ b/tests/farm/html/run_omit_2.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for main.""" + """Run coverage.py and make an HTML report for main.""" import coverage - cov = coverage.coverage(include=["./*"]) + cov = coverage.Coverage(include=["./*"]) cov.start() import main # pragma: nested cov.stop() # pragma: nested diff --git a/tests/farm/html/run_omit_3.py b/tests/farm/html/run_omit_3.py index 07b38a8a..96ed0822 100644 --- a/tests/farm/html/run_omit_3.py +++ b/tests/farm/html/run_omit_3.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for main.""" + """Run coverage.py and make an HTML report for main.""" import coverage - cov = coverage.coverage(include=["./*"]) + cov = coverage.Coverage(include=["./*"]) cov.start() import main # pragma: nested cov.stop() # pragma: nested diff --git a/tests/farm/html/run_omit_4.py b/tests/farm/html/run_omit_4.py index 8c0c789c..b212ef40 100644 --- a/tests/farm/html/run_omit_4.py +++ b/tests/farm/html/run_omit_4.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for main.""" + """Run coverage.py and make an HTML report for main.""" import coverage - cov = coverage.coverage(config_file="omit4.ini", include=["./*"]) + cov = coverage.Coverage(config_file="omit4.ini", include=["./*"]) cov.start() import main # pragma: nested cov.stop() # pragma: nested diff --git a/tests/farm/html/run_omit_5.py b/tests/farm/html/run_omit_5.py index 4ba5e50c..ed61d209 100644 --- a/tests/farm/html/run_omit_5.py +++ b/tests/farm/html/run_omit_5.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for main.""" + """Run coverage.py and make an HTML report for main.""" import coverage - cov = coverage.coverage(config_file="omit5.ini", include=["./*"]) + cov = coverage.Coverage(config_file="omit5.ini", include=["./*"]) cov.start() import main # pragma: nested cov.stop() # pragma: nested diff --git a/tests/farm/html/run_other.py b/tests/farm/html/run_other.py index 05efa0fc..92753d4b 100644 --- a/tests/farm/html/run_other.py +++ b/tests/farm/html/run_other.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for everything.""" + """Run coverage.py and make an HTML report for everything.""" import coverage - cov = coverage.coverage(include=["./*", "../othersrc/*"]) + cov = coverage.Coverage(include=["./*", "../othersrc/*"]) cov.start() import here # pragma: nested cov.stop() # pragma: nested @@ -19,8 +22,8 @@ for p in glob.glob("html_other/*_other_py.html"): # and check that certain key strings are in the output. compare("gold_other", "html_other", size_within=10, file_pattern="*.html") contains("html_other/index.html", - "<a href='here_py.html'>here.py</a>", - "other_py.html'>", "other.py</a>", + '<a href="here_py.html">here.py</a>', + 'other_py.html">', 'other.py</a>', ) clean("html_other") diff --git a/tests/farm/html/run_partial.py b/tests/farm/html/run_partial.py index 38790796..fedf7082 100644 --- a/tests/farm/html/run_partial.py +++ b/tests/farm/html/run_partial.py @@ -1,9 +1,12 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import sys def html_it(): - """Run coverage and make an HTML report for partial.""" + """Run coverage.py and make an HTML report for partial.""" import coverage - cov = coverage.coverage(branch=True) + cov = coverage.Coverage(branch=True) cov.start() import partial # pragma: nested cov.stop() # pragma: nested @@ -15,17 +18,17 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_partial", "html_partial", size_within=10, file_pattern="*.html") contains("html_partial/partial_py.html", - "<p id='t5' class='stm run hide_run'>", - "<p id='t8' class='stm run hide_run'>", - "<p id='t11' class='stm run hide_run'>", + '<p id="t8" class="stm run hide_run">', + '<p id="t11" class="stm run hide_run">', + '<p id="t14" class="stm run hide_run">', # The "if 0" and "if 1" statements are optimized away. - "<p id='t14' class='pln'>", + '<p id="t17" class="pln">', ) contains("html_partial/index.html", - "<a href='partial_py.html'>partial.py</a>", + '<a href="partial_py.html">partial.py</a>', ) contains("html_partial/index.html", - "<span class='pc_cov'>100%</span>" + '<span class="pc_cov">100%</span>' ) clean("html_partial") diff --git a/tests/farm/html/run_styled.py b/tests/farm/html/run_styled.py index a18096a4..eeebfe61 100644 --- a/tests/farm/html/run_styled.py +++ b/tests/farm/html/run_styled.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for a.""" + """Run coverage.py and make an HTML report for a.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import a # pragma: nested cov.stop() # pragma: nested @@ -14,15 +17,15 @@ runfunc(html_it, rundir="src") compare("gold_styled", "html_styled", size_within=10, file_pattern="*.html") compare("gold_styled", "html_styled", size_within=10, file_pattern="*.css") contains("html_styled/a_py.html", - "<link rel='stylesheet' href='extra.css' type='text/css'>", - "<span class='key'>if</span> <span class='num'>1</span> <span class='op'><</span> <span class='num'>2</span>", - " <span class='nam'>a</span> <span class='op'>=</span> <span class='num'>3</span>", - "<span class='pc_cov'>67%</span>" + '<link rel="stylesheet" href="extra.css" type="text/css">', + '<span class="key">if</span> <span class="num">1</span> <span class="op"><</span> <span class="num">2</span>', + ' <span class="nam">a</span> <span class="op">=</span> <span class="num">3</span>', + '<span class="pc_cov">67%</span>' ) contains("html_styled/index.html", - "<link rel='stylesheet' href='extra.css' type='text/css'>", - "<a href='a_py.html'>a.py</a>", - "<span class='pc_cov'>67%</span>" + '<link rel="stylesheet" href="extra.css" type="text/css">', + '<a href="a_py.html">a.py</a>', + '<span class="pc_cov">67%</span>' ) clean("html_styled") diff --git a/tests/farm/html/run_tabbed.py b/tests/farm/html/run_tabbed.py index 679db2ed..6dacff53 100644 --- a/tests/farm/html/run_tabbed.py +++ b/tests/farm/html/run_tabbed.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for tabbed.""" + """Run coverage.py and make an HTML report for tabbed.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import tabbed # pragma: nested cov.stop() # pragma: nested @@ -13,11 +16,11 @@ runfunc(html_it, rundir="src") contains("src/tabbed.py", "\tif x:\t\t\t\t\t# look nice") contains("html_tabbed/tabbed_py.html", - "> <span class='key'>if</span> " - "<span class='nam'>x</span><span class='op'>:</span>" - " " - " " - "<span class='com'># look nice</span>" + '> <span class="key">if</span> ' + '<span class="nam">x</span><span class="op">:</span>' + ' ' + ' ' + '<span class="com"># look nice</span>' ) doesnt_contain("html_tabbed/tabbed_py.html", "\t") diff --git a/tests/farm/html/run_unicode.py b/tests/farm/html/run_unicode.py index ba34f63e..888d7e54 100644 --- a/tests/farm/html/run_unicode.py +++ b/tests/farm/html/run_unicode.py @@ -1,7 +1,10 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + def html_it(): - """Run coverage and make an HTML report for unicode.py.""" + """Run coverage.py and make an HTML report for unicode.py.""" import coverage - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import unicode # pragma: nested cov.stop() # pragma: nested @@ -13,12 +16,12 @@ runfunc(html_it, rundir="src") # and check that certain key strings are in the output. compare("gold_unicode", "html_unicode", size_within=10, file_pattern="*.html") contains("html_unicode/unicode_py.html", - "<span class='str'>"ʎd˙ǝbɐɹǝʌoɔ"</span>", + '<span class="str">"ʎd˙ǝbɐɹǝʌoɔ"</span>', ) contains_any("html_unicode/unicode_py.html", - "<span class='str'>"db40,dd00: x��"</span>", - "<span class='str'>"db40,dd00: x󠄀"</span>", + '<span class="str">"db40,dd00: x��"</span>', + '<span class="str">"db40,dd00: x󠄀"</span>', ) clean("html_unicode") diff --git a/tests/farm/html/run_y_xml_branch.py b/tests/farm/html/run_y_xml_branch.py index 59228077..9d3aba2f 100644 --- a/tests/farm/html/run_y_xml_branch.py +++ b/tests/farm/html/run_y_xml_branch.py @@ -1,15 +1,18 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + source_path = None def xml_it(): - """Run coverage and make an XML report for y.""" - import coverage - cov = coverage.coverage(branch=True) + """Run coverage.py and make an XML report for y.""" + import coverage, coverage.files + cov = coverage.Coverage(branch=True) cov.start() import y # pragma: nested cov.stop() # pragma: nested cov.xml_report(y, outfile="../xml_branch/coverage.xml") global source_path - source_path = cov.file_locator.relative_dir.rstrip('/') + source_path = coverage.files.relative_directory().rstrip('/') import os if not os.path.exists("xml_branch"): diff --git a/tests/farm/html/src/a.py b/tests/farm/html/src/a.py index 9e71aebd..85764e21 100644 --- a/tests/farm/html/src/a.py +++ b/tests/farm/html/src/a.py @@ -1,4 +1,7 @@ -# A test file for HTML reporting by coverage. +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A test file for HTML reporting by coverage.py. if 1 < 2: # Needed a < to look at HTML entities. diff --git a/tests/farm/html/src/b.py b/tests/farm/html/src/b.py index 3bf73a9f..cb673c22 100644 --- a/tests/farm/html/src/b.py +++ b/tests/farm/html/src/b.py @@ -1,4 +1,7 @@ -# A test file for HTML reporting by coverage. +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A test file for HTML reporting by coverage.py. def one(x): # This will be a branch that misses the else. diff --git a/tests/farm/html/src/bom.py b/tests/farm/html/src/bom.py index 1aff5d52..21d26ca2 100644 --- a/tests/farm/html/src/bom.py +++ b/tests/farm/html/src/bom.py @@ -1,11 +1,14 @@ -# A Python source file in utf-8, with BOM.
-math = "3×4 = 12, ÷2 = 6±0"
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt -import sys
-
-if sys.version_info >= (3, 0):
- assert len(math) == 18
- assert len(math.encode('utf-8')) == 21
-else:
- assert len(math) == 21
- assert len(math.decode('utf-8')) == 18
+# A Python source file in utf-8, with BOM. +math = "3×4 = 12, ÷2 = 6±0" + +import sys + +if sys.version_info >= (3, 0): + assert len(math) == 18 + assert len(math.encode('utf-8')) == 21 +else: + assert len(math) == 21 + assert len(math.decode('utf-8')) == 18 diff --git a/tests/farm/html/src/coverage.xml b/tests/farm/html/src/coverage.xml index e20cdaec..ccffd201 100644 --- a/tests/farm/html/src/coverage.xml +++ b/tests/farm/html/src/coverage.xml @@ -1,6 +1,6 @@ <?xml version="1.0" ?>
<!DOCTYPE coverage
- SYSTEM 'http://cobertura.sourceforge.net/xml/coverage-03.dtd'>
+ SYSTEM 'https://raw.githubusercontent.com/cobertura/web/f0366e5e2cf18f111cbd61fc34ef720a6584ba02/htdocs/xml/coverage-03.dtd'>
<coverage branch-rate="0.0" line-rate="0.666666666667" timestamp="1263087779313" version="3.3a1">
<!-- Generated by coverage.py: http://nedbatchelder.com/code/coverage -->
<sources>
diff --git a/tests/farm/html/src/here.py b/tests/farm/html/src/here.py index d0d26ea7..fee9960d 100644 --- a/tests/farm/html/src/here.py +++ b/tests/farm/html/src/here.py @@ -1,4 +1,7 @@ -# A test file for HTML reporting by coverage. +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A test file for HTML reporting by coverage.py. import other diff --git a/tests/farm/html/src/isolatin1.py b/tests/farm/html/src/isolatin1.py index 7a49b07d..55a6f7de 100644 --- a/tests/farm/html/src/isolatin1.py +++ b/tests/farm/html/src/isolatin1.py @@ -1,5 +1,8 @@ -# A Python source file in another encoding. # -*- coding: iso8859-1 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A Python source file in another encoding. math = "34 = 12, 2 = 60" assert len(math) == 18 diff --git a/tests/farm/html/src/m1.py b/tests/farm/html/src/m1.py index 927e1f6b..524fb0aa 100644 --- a/tests/farm/html/src/m1.py +++ b/tests/farm/html/src/m1.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + m1a = 1 m1b = 2 diff --git a/tests/farm/html/src/m2.py b/tests/farm/html/src/m2.py index ffddf6cf..2d13bfe2 100644 --- a/tests/farm/html/src/m2.py +++ b/tests/farm/html/src/m2.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + m2a = 1 m2b = 2 diff --git a/tests/farm/html/src/m3.py b/tests/farm/html/src/m3.py index 395d7d25..96e8b992 100644 --- a/tests/farm/html/src/m3.py +++ b/tests/farm/html/src/m3.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + m3a = 1 m3b = 2 diff --git a/tests/farm/html/src/main.py b/tests/farm/html/src/main.py index ce894465..238d0b58 100644 --- a/tests/farm/html/src/main.py +++ b/tests/farm/html/src/main.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import m1 import m2 import m3 diff --git a/tests/farm/html/src/omit4.ini b/tests/farm/html/src/omit4.ini index 6821ecda..b792e703 100644 --- a/tests/farm/html/src/omit4.ini +++ b/tests/farm/html/src/omit4.ini @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + [report] omit = m2.py diff --git a/tests/farm/html/src/omit5.ini b/tests/farm/html/src/omit5.ini index 7e32b414..3d8dbcf2 100644 --- a/tests/farm/html/src/omit5.ini +++ b/tests/farm/html/src/omit5.ini @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + [report] omit = fooey diff --git a/tests/farm/html/src/partial.py b/tests/farm/html/src/partial.py index 8d62f5c5..66dddacd 100644 --- a/tests/farm/html/src/partial.py +++ b/tests/farm/html/src/partial.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # partial branches a = 3 diff --git a/tests/farm/html/src/run_a_xml_2.ini b/tests/farm/html/src/run_a_xml_2.ini index 8d28f97b..5b5f18dc 100644 --- a/tests/farm/html/src/run_a_xml_2.ini +++ b/tests/farm/html/src/run_a_xml_2.ini @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Put all the XML output in xml_2 [xml] output = ../xml_2/coverage.xml diff --git a/tests/farm/html/src/tabbed.py b/tests/farm/html/src/tabbed.py index 2035852f..e897e9fa 100644 --- a/tests/farm/html/src/tabbed.py +++ b/tests/farm/html/src/tabbed.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # This file should have tabs. x = 1 if x: diff --git a/tests/farm/html/src/unicode.py b/tests/farm/html/src/unicode.py index 08e1b540..37c5533a 100644 --- a/tests/farm/html/src/unicode.py +++ b/tests/farm/html/src/unicode.py @@ -1,5 +1,8 @@ -# A Python source file with exotic characters. # -*- coding: utf-8 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A Python source file with exotic characters. upside_down = "ʎd˙ǝbɐɹǝʌoɔ" surrogate = "db40,dd00: x󠄀" diff --git a/tests/farm/html/src/y.py b/tests/farm/html/src/y.py index af7c9689..a50bb629 100644 --- a/tests/farm/html/src/y.py +++ b/tests/farm/html/src/y.py @@ -1,4 +1,7 @@ -# A test file for XML reporting by coverage. +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +# A test file for XML reporting by coverage.py. def choice(x): if x < 2: diff --git a/tests/farm/run/run_chdir.py b/tests/farm/run/run_chdir.py index 367cd0ad..9e3c7515 100644 --- a/tests/farm/run/run_chdir.py +++ b/tests/farm/run/run_chdir.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + copy("src", "out") run(""" coverage run chdir.py diff --git a/tests/farm/run/run_timid.py b/tests/farm/run/run_timid.py index 99155b85..a632cea3 100644 --- a/tests/farm/run/run_timid.py +++ b/tests/farm/run/run_timid.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Test that the --timid command line argument properly swaps the tracer # function for a simpler one. # diff --git a/tests/farm/run/run_xxx.py b/tests/farm/run/run_xxx.py index 6fedc934..62a862e5 100644 --- a/tests/farm/run/run_xxx.py +++ b/tests/farm/run/run_xxx.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + copy("src", "out") run(""" coverage run xxx diff --git a/tests/farm/run/src/chdir.py b/tests/farm/run/src/chdir.py index 6d834924..35cfcc81 100644 --- a/tests/farm/run/src/chdir.py +++ b/tests/farm/run/src/chdir.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import os print("Line One") os.chdir("subdir") diff --git a/tests/farm/run/src/showtrace.py b/tests/farm/run/src/showtrace.py index e97412e0..3a2750a6 100644 --- a/tests/farm/run/src/showtrace.py +++ b/tests/farm/run/src/showtrace.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Show the current frame's trace function, so that we can test what the # command-line options do to the trace function used. diff --git a/tests/farm/run/src/xxx b/tests/farm/run/src/xxx index 8f727f08..864da457 100644 --- a/tests/farm/run/src/xxx +++ b/tests/farm/run/src/xxx @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # This is a python file though it doesn't look like it, like a main script. a = b = c = d = 0 a = 3 diff --git a/tests/helpers.py b/tests/helpers.py index c26f4859..3d6be141 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -1,10 +1,11 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Helpers for coverage.py tests.""" import subprocess -# This isn't really a backward compatibility thing, should be moved into a -# helpers file or something. def run_command(cmd): """Run a command in a sub-process. diff --git a/tests/js/tests.js b/tests/js/tests.js index 73b4ce2b..504a158e 100644 --- a/tests/js/tests.js +++ b/tests/js/tests.js @@ -1,3 +1,6 @@ +/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ +/* For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt */ + // Tests of coverage.py HTML report chunk navigation. /*global coverage, test, module, equals, jQuery, $ */ diff --git a/tests/modules/covmod1.py b/tests/modules/covmod1.py index b3f5e5f2..0f9638b8 100644 --- a/tests/modules/covmod1.py +++ b/tests/modules/covmod1.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # covmod1.py: Simplest module for testing. i = 1 i += 1 diff --git a/tests/modules/pkg1/p1a.py b/tests/modules/pkg1/p1a.py index 337add49..5d81b1fa 100644 --- a/tests/modules/pkg1/p1a.py +++ b/tests/modules/pkg1/p1a.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import os, sys # Invoke functions in os and sys so we can see if we measure code there. diff --git a/tests/modules/pkg1/p1b.py b/tests/modules/pkg1/p1b.py index 59d6fb54..53505cef 100644 --- a/tests/modules/pkg1/p1b.py +++ b/tests/modules/pkg1/p1b.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + x = 1 y = 2 z = 3 diff --git a/tests/modules/pkg1/p1c.py b/tests/modules/pkg1/p1c.py index a9aeef04..98f319e8 100644 --- a/tests/modules/pkg1/p1c.py +++ b/tests/modules/pkg1/p1c.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + a = 1 b = 2 c = 3 diff --git a/tests/modules/pkg1/runmod2.py b/tests/modules/pkg1/runmod2.py index b52964cb..5911db7b 100644 --- a/tests/modules/pkg1/runmod2.py +++ b/tests/modules/pkg1/runmod2.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Used in the tests for run_python_module import sys print("runmod2: passed %s" % sys.argv[1]) diff --git a/tests/modules/pkg1/sub/ps1a.py b/tests/modules/pkg1/sub/ps1a.py index 4b6a15cc..44d3b274 100644 --- a/tests/modules/pkg1/sub/ps1a.py +++ b/tests/modules/pkg1/sub/ps1a.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + d = 1 e = 2 f = 3 diff --git a/tests/modules/pkg1/sub/runmod3.py b/tests/modules/pkg1/sub/runmod3.py index 3a1ad155..1f5ce27e 100644 --- a/tests/modules/pkg1/sub/runmod3.py +++ b/tests/modules/pkg1/sub/runmod3.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Used in the tests for run_python_module import sys print("runmod3: passed %s" % sys.argv[1]) diff --git a/tests/modules/pkg2/p2a.py b/tests/modules/pkg2/p2a.py index b606711d..62caae22 100644 --- a/tests/modules/pkg2/p2a.py +++ b/tests/modules/pkg2/p2a.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + q = 1 r = 1 s = 1 diff --git a/tests/modules/pkg2/p2b.py b/tests/modules/pkg2/p2b.py index 7a34e2c6..73716eb4 100644 --- a/tests/modules/pkg2/p2b.py +++ b/tests/modules/pkg2/p2b.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + t = 1 u = 1 v = 1 diff --git a/tests/modules/plugins/a_plugin.py b/tests/modules/plugins/a_plugin.py index 2ff84dac..2a9910d0 100644 --- a/tests/modules/plugins/a_plugin.py +++ b/tests/modules/plugins/a_plugin.py @@ -4,3 +4,6 @@ from coverage import CoveragePlugin class Plugin(CoveragePlugin): pass + +def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) diff --git a/tests/modules/plugins/another.py b/tests/modules/plugins/another.py index 2ff84dac..096d3b9d 100644 --- a/tests/modules/plugins/another.py +++ b/tests/modules/plugins/another.py @@ -1,6 +1,12 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """A plugin for tests to reference.""" from coverage import CoveragePlugin class Plugin(CoveragePlugin): pass + +def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) diff --git a/tests/modules/runmod1.py b/tests/modules/runmod1.py index 671d81ef..b43b299a 100644 --- a/tests/modules/runmod1.py +++ b/tests/modules/runmod1.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Used in the tests for run_python_module import sys print("runmod1: passed %s" % sys.argv[1]) diff --git a/tests/modules/usepkgs.py b/tests/modules/usepkgs.py index 93c7d904..4e94acaa 100644 --- a/tests/modules/usepkgs.py +++ b/tests/modules/usepkgs.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + import pkg1.p1a, pkg1.p1b import pkg2.p2a, pkg2.p2b import othermods.othera, othermods.otherb diff --git a/tests/moremodules/othermods/othera.py b/tests/moremodules/othermods/othera.py index 78896928..b3ee9c04 100644 --- a/tests/moremodules/othermods/othera.py +++ b/tests/moremodules/othermods/othera.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + o = 1 p = 2 diff --git a/tests/moremodules/othermods/otherb.py b/tests/moremodules/othermods/otherb.py index 2bd8a441..334fdc4a 100644 --- a/tests/moremodules/othermods/otherb.py +++ b/tests/moremodules/othermods/otherb.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + q = 3 r = 4 diff --git a/tests/moremodules/othermods/sub/osa.py b/tests/moremodules/othermods/sub/osa.py index 0139d28b..4005640e 100644 --- a/tests/moremodules/othermods/sub/osa.py +++ b/tests/moremodules/othermods/sub/osa.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + s = 5 t = 6 diff --git a/tests/moremodules/othermods/sub/osb.py b/tests/moremodules/othermods/sub/osb.py index b024b148..7d96fb79 100644 --- a/tests/moremodules/othermods/sub/osb.py +++ b/tests/moremodules/othermods/sub/osb.py @@ -1,2 +1,5 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + u = 7 v = 8 diff --git a/tests/osinfo.py b/tests/osinfo.py index 0b86ef54..54153349 100644 --- a/tests/osinfo.py +++ b/tests/osinfo.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """OS information for testing.""" from coverage import env diff --git a/tests/plugin1.py b/tests/plugin1.py index f9da35c8..c28b886f 100644 --- a/tests/plugin1.py +++ b/tests/plugin1.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """A plugin for test_plugins.py to import.""" import os.path @@ -44,3 +47,8 @@ class FileReporter(coverage.plugin.FileReporter): def excluded_statements(self): return set([]) + + +def coverage_init(reg, options): # pylint: disable=unused-argument + """Called by coverage to initialize the plugins here.""" + reg.add_file_tracer(Plugin()) diff --git a/tests/plugin2.py b/tests/plugin2.py index 1d5d9e9f..cbd2fc11 100644 --- a/tests/plugin2.py +++ b/tests/plugin2.py @@ -1,13 +1,15 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """A plugin for test_plugins.py to import.""" import os.path import coverage -# pylint: disable=missing-docstring - class Plugin(coverage.CoveragePlugin): + """A plugin for testing.""" def file_tracer(self, filename): if "render.py" in filename: return RenderFileTracer() @@ -25,7 +27,8 @@ class RenderFileTracer(coverage.plugin.FileTracer): def dynamic_source_filename(self, filename, frame): if frame.f_code.co_name != "render": return None - return frame.f_locals['filename'] + source_filename = os.path.abspath(frame.f_locals['filename']) + return source_filename def line_number_range(self, frame): lineno = frame.f_locals['linenum'] @@ -33,8 +36,14 @@ class RenderFileTracer(coverage.plugin.FileTracer): class FileReporter(coverage.plugin.FileReporter): + """A goofy file reporter.""" def statements(self): # Goofy test arrangement: claim that the file has as many lines as the # number in its name. num = os.path.basename(self.filename).split(".")[0].split("_")[1] return set(range(1, int(num)+1)) + + +def coverage_init(reg, options): # pylint: disable=unused-argument + """Called by coverage to initialize the plugins here.""" + reg.add_file_tracer(Plugin()) diff --git a/tests/stress_phystoken.tok b/tests/stress_phystoken.tok index 8d1b6bec..eb2fb669 100644 --- a/tests/stress_phystoken.tok +++ b/tests/stress_phystoken.tok @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + # Here's some random Python so that test_tokenize_myself will have some # stressful stuff to try. This file is .tok instead of .py so pylint won't # complain about it, check_eol won't look at it, etc. diff --git a/tests/stress_phystoken_dos.tok b/tests/stress_phystoken_dos.tok index b08fd70e..5b016a77 100644 --- a/tests/stress_phystoken_dos.tok +++ b/tests/stress_phystoken_dos.tok @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
+
# Here's some random Python so that test_tokenize_myself will have some
# stressful stuff to try. This file is .tok instead of .py so pylint won't
# complain about it, check_eol won't look at it, etc.
diff --git a/tests/test_api.py b/tests/test_api.py index a21372ad..25d104c4 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,93 +1,22 @@ -"""Tests for Coverage's API.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py's API.""" import fnmatch import os -import re import sys import textwrap import coverage from coverage.backward import StringIO +from coverage.misc import CoverageException from tests.coveragetest import CoverageTest -class SingletonApiTest(CoverageTest): - """Tests of the old-fashioned singleton API.""" - - def setUp(self): - super(SingletonApiTest, self).setUp() - # These tests use the singleton module interface. Prevent it from - # writing .coverage files at exit. - coverage.use_cache(0) - - def do_report_work(self, modname): - """Create a module named `modname`, then measure it.""" - coverage.erase() - - self.make_file(modname+".py", """\ - a = 1 - b = 2 - if b == 3: - c = 4 - d = 5 - e = 6 - f = 7 - """) - - # Import the Python file, executing it. - self.start_import_stop(coverage, modname) - - def test_simple(self): - coverage.erase() - - self.make_file("mycode.py", """\ - a = 1 - b = 2 - if b == 3: - c = 4 - d = 5 - """) - - # Import the Python file, executing it. - self.start_import_stop(coverage, "mycode") - - _, statements, missing, missingtext = coverage.analysis("mycode.py") - self.assertEqual(statements, [1,2,3,4,5]) - self.assertEqual(missing, [4]) - self.assertEqual(missingtext, "4") - - def test_report(self): - self.do_report_work("mycode2") - coverage.report(["mycode2.py"]) - self.assertEqual(self.stdout(), textwrap.dedent("""\ - Name Stmts Miss Cover Missing - ------------------------------------------ - mycode2.py 7 3 57% 4-6 - """)) - - def test_report_file(self): - # The file= argument of coverage.report makes the report go there. - self.do_report_work("mycode3") - fout = StringIO() - coverage.report(["mycode3.py"], file=fout) - self.assertEqual(self.stdout(), "") - self.assertEqual(fout.getvalue(), textwrap.dedent("""\ - Name Stmts Miss Cover Missing - ------------------------------------------ - mycode3.py 7 3 57% 4-6 - """)) - - def test_report_default(self): - # Calling report() with no morfs will report on whatever was executed. - self.do_report_work("mycode4") - coverage.report() - rpt = re.sub(r"\s+", " ", self.stdout()) - self.assertIn("mycode4.py 7 3 57% 4-6", rpt) - - class ApiTest(CoverageTest): - """Api-oriented tests for Coverage.""" + """Api-oriented tests for coverage.py.""" def clean_files(self, files, pats): """Remove names matching `pats` from `files`, a list of filenames.""" @@ -107,7 +36,7 @@ class ApiTest(CoverageTest): self.assertCountEqual(here, files) def test_unexecuted_file(self): - cov = coverage.coverage() + cov = coverage.Coverage() self.make_file("mycode.py", """\ a = 1 @@ -140,7 +69,7 @@ class ApiTest(CoverageTest): """) # Import the Python file, executing it. - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "mymain") filename, _, _, _ = cov.analysis("mymain.py") @@ -155,7 +84,7 @@ class ApiTest(CoverageTest): # Import the Python file, executing it again, once it's been compiled # already. - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "mymain") filename, _, _, _ = cov.analysis("mymain.py") @@ -176,7 +105,7 @@ class ApiTest(CoverageTest): """) # Measure without the stdlib. - cov1 = coverage.coverage() + cov1 = coverage.Coverage() self.assertEqual(cov1.config.cover_pylib, False) self.start_import_stop(cov1, "mymain") @@ -188,7 +117,7 @@ class ApiTest(CoverageTest): self.assertEqual(statements, missing) # Measure with the stdlib. - cov2 = coverage.coverage(cover_pylib=True) + cov2 = coverage.Coverage(cover_pylib=True) self.start_import_stop(cov2, "mymain") # some statements were marked executed in mymain.py @@ -207,7 +136,7 @@ class ApiTest(CoverageTest): """) # Measure without the stdlib, but include colorsys. - cov1 = coverage.coverage(cover_pylib=False, include=["*/colorsys.py"]) + cov1 = coverage.Coverage(cover_pylib=False, include=["*/colorsys.py"]) self.start_import_stop(cov1, "mymain") # some statements were marked executed in colorsys.py @@ -218,7 +147,7 @@ class ApiTest(CoverageTest): self.assertEqual(statements, missing) def test_exclude_list(self): - cov = coverage.coverage() + cov = coverage.Coverage() cov.clear_exclude() self.assertEqual(cov.get_exclude_list(), []) cov.exclude("foo") @@ -230,7 +159,7 @@ class ApiTest(CoverageTest): self.assertEqual(cov.get_exclude_list(), []) def test_exclude_partial_list(self): - cov = coverage.coverage() + cov = coverage.Coverage() cov.clear_exclude(which='partial') self.assertEqual(cov.get_exclude_list(which='partial'), []) cov.exclude("foo", which='partial') @@ -244,7 +173,7 @@ class ApiTest(CoverageTest): self.assertEqual(cov.get_exclude_list(which='partial'), []) def test_exclude_and_partial_are_separate_lists(self): - cov = coverage.coverage() + cov = coverage.Coverage() cov.clear_exclude(which='partial') cov.clear_exclude(which='exclude') cov.exclude("foo", which='partial') @@ -271,7 +200,7 @@ class ApiTest(CoverageTest): """) self.assertFiles(["datatest1.py"]) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "datatest1") cov.save() self.assertFiles(["datatest1.py", ".coverage"]) @@ -283,7 +212,7 @@ class ApiTest(CoverageTest): """) self.assertFiles(["datatest2.py"]) - cov = coverage.coverage(data_file="cov.data") + cov = coverage.Coverage(data_file="cov.data") self.start_import_stop(cov, "datatest2") cov.save() self.assertFiles(["datatest2.py", "cov.data"]) @@ -295,7 +224,7 @@ class ApiTest(CoverageTest): """) self.assertFiles(["datatest3.py"]) - cov = coverage.coverage(data_file="cov.data", data_suffix="14") + cov = coverage.Coverage(data_file="cov.data", data_suffix="14") self.start_import_stop(cov, "datatest3") cov.save() self.assertFiles(["datatest3.py", "cov.data.14"]) @@ -311,16 +240,16 @@ class ApiTest(CoverageTest): """) self.assertFiles(["datatest4.py", ".coveragerc"]) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "datatest4") cov.save() self.assertFiles(["datatest4.py", ".coveragerc", "mydata.dat"]) def test_empty_reporting(self): - # Used to be you'd get an exception reporting on nothing... - cov = coverage.coverage() + # empty summary reports raise exception, just like the xml report + cov = coverage.Coverage() cov.erase() - cov.report() + self.assertRaises(CoverageException, cov.report) def test_start_stop_start_stop(self): self.make_file("code1.py", """\ @@ -330,7 +259,7 @@ class ApiTest(CoverageTest): code2 = 1 code2 = 2 """) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "code1") cov.save() self.start_import_stop(cov, "code2") @@ -351,7 +280,7 @@ class ApiTest(CoverageTest): code2 = 1 code2 = 2 """) - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() self.import_local_file("code1") cov.save() @@ -445,15 +374,15 @@ class SourceOmitIncludeTest(OmitIncludeTestsMixin, CoverageTest): def coverage_usepkgs(self, **kwargs): """Run coverage on usepkgs and return the line summary. - Arguments are passed to the `coverage.coverage` constructor. + Arguments are passed to the `coverage.Coverage` constructor. """ - cov = coverage.coverage(**kwargs) + cov = coverage.Coverage(**kwargs) cov.start() import usepkgs # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested - cov._harvest_data() # private! sshhh... - summary = cov.data.summary() + data = cov.get_data() + summary = data.line_counts() for k, v in list(summary.items()): assert k.endswith(".py") summary[k[:-3]] = v @@ -487,7 +416,7 @@ class ReportIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest): def coverage_usepkgs(self, **kwargs): """Try coverage.report().""" - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import usepkgs # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -506,7 +435,7 @@ class XmlIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest): def coverage_usepkgs(self, **kwargs): """Try coverage.xml_report().""" - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import usepkgs # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -517,7 +446,7 @@ class XmlIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest): class AnalysisTest(CoverageTest): """Test the numerical analysis of results.""" def test_many_missing_branches(self): - cov = coverage.coverage(branch=True) + cov = coverage.Coverage(branch=True) self.make_file("missing.py", """\ def fun1(x): @@ -555,7 +484,7 @@ class PluginTest(CoverageTest): """ def pretend_to_be_nose_with_cover(self, erase): """This is what the nose --with-cover plugin does.""" - cov = coverage.coverage() + cov = coverage.Coverage() self.make_file("no_biggie.py", """\ a = 1 diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 81fa7e6a..df303d8b 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -1,4 +1,7 @@ -"""Tests for Coverage.py's arc measurement.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py's arc measurement.""" from tests.coveragetest import CoverageTest @@ -8,7 +11,7 @@ from coverage.files import abs_file class SimpleArcTest(CoverageTest): - """Tests for Coverage.py's arc measurement.""" + """Tests for coverage.py's arc measurement.""" def test_simple_sequence(self): self.check_coverage("""\ @@ -560,10 +563,123 @@ class ExceptionArcTest(CoverageTest): arcz_missing="67 7B", arcz_unpredicted="68") +class YieldTest(CoverageTest): + """Arc tests for generators.""" + + def test_yield_in_loop(self): + self.check_coverage("""\ + def gen(inp): + for n in inp: + yield n + + list(gen([1,2,3])) + """, + arcz=".1 .2 23 2. 32 15 5.", + arcz_missing="", + arcz_unpredicted="") + + def test_padded_yield_in_loop(self): + self.check_coverage("""\ + def gen(inp): + i = 2 + for n in inp: + i = 4 + yield n + i = 6 + i = 7 + + list(gen([1,2,3])) + """, + arcz=".1 19 9. .2 23 34 45 56 63 37 7.", + arcz_missing="", + arcz_unpredicted="") + + def test_bug_308(self): + self.check_coverage("""\ + def run(): + for i in range(10): + yield lambda: i + + for f in run(): + print(f()) + """, + arcz=".1 15 56 65 5. .2 23 32 2. .3 3-3", + arcz_missing="", + arcz_unpredicted="") + + self.check_coverage("""\ + def run(): + yield lambda: 100 + for i in range(10): + yield lambda: i + + for f in run(): + print(f()) + """, + arcz=".1 16 67 76 6. .2 23 34 43 3. 2-2 .4 4-4", + arcz_missing="", + arcz_unpredicted="") + + self.check_coverage("""\ + def run(): + yield lambda: 100 # no branch miss + + for f in run(): + print(f()) + """, + arcz=".1 14 45 54 4. .2 2. 2-2", + arcz_missing="", + arcz_unpredicted="") + + def test_bug_324(self): + # This code is tricky: the list() call pulls all the values from gen(), + # but each of them is a generator itself that is never iterated. As a + # result, the generator expression on line 3 is never entered or run. + self.check_coverage("""\ + def gen(inp): + for n in inp: + yield (i * 2 for i in range(n)) + + list(gen([1,2,3])) + """, + arcz= + ".1 15 5. " # The module level + ".2 23 32 2. " # The gen() function + ".3 3-3", # The generator expression + arcz_missing=".3 3-3", + arcz_unpredicted="") + + def test_coroutines(self): + self.check_coverage("""\ + def double_inputs(): + while [1]: # avoid compiler differences + x = yield + x *= 2 + yield x + + gen = double_inputs() + next(gen) + print(gen.send(10)) + next(gen) + print(gen.send(6)) + """, + arcz= + ".1 17 78 89 9A AB B. " + ".2 23 34 45 52 2.", + arcz_missing="2.", + arcz_unpredicted="") + self.assertEqual(self.stdout(), "20\n12\n") + + class MiscArcTest(CoverageTest): """Miscellaneous arc-measuring tests.""" def test_dict_literal(self): + if env.PYVERSION < (3, 5): + arcz = ".1 19 9." + else: + # Python 3.5 changed how dict literals are constructed. + arcz = ".1 19 9-2" self.check_coverage("""\ d = { 'a': 2, @@ -575,7 +691,7 @@ class MiscArcTest(CoverageTest): } assert d """, - arcz=".1 19 9.") + arcz=arcz) def test_pathologically_long_code_object(self): # https://bitbucket.org/ned/coveragepy/issue/359 @@ -647,6 +763,6 @@ class LineDataTest(CoverageTest): self.start_import_stop(cov, "fun1") - cov._harvest_data() - fun1_lines = cov.data.line_data()[abs_file("fun1.py")] - self.assertEqual(fun1_lines, [1, 2, 5]) + data = cov.get_data() + fun1_lines = data.lines(abs_file("fun1.py")) + self.assertCountEqual(fun1_lines, [1, 2, 5]) diff --git a/tests/test_backward.py b/tests/test_backward.py index 09803ba7..fbb9ad8b 100644 --- a/tests/test_backward.py +++ b/tests/test_backward.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests that our version shims in backward.py are working.""" from coverage.backunittest import TestCase diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py index 775e0033..a379d402 100644 --- a/tests/test_cmdline.py +++ b/tests/test_cmdline.py @@ -1,4 +1,7 @@ -"""Test cmdline.py for coverage.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Test cmdline.py for coverage.py.""" import pprint import re @@ -11,6 +14,7 @@ import mock import coverage import coverage.cmdline from coverage.config import CoverageConfig +from coverage.data import CoverageData, CoverageDataFiles from coverage.misc import ExceptionDuringRun from tests.coveragetest import CoverageTest, OK, ERR @@ -62,7 +66,7 @@ class BaseCmdLineTest(CoverageTest): """ m = self.model_object() - ret = coverage.CoverageScript( + ret = coverage.cmdline.CoverageScript( _covpkg=m, _run_python_file=m.run_python_file, _run_python_module=m.run_python_module, _help_fn=m.help_fn ).command_line(shlex.split(args)) @@ -139,38 +143,6 @@ class BaseCmdLineTestTest(BaseCmdLineTest): self.cmd_executes_same("run", "debug") -class FakeCoverageForDebugData(object): - """Just enough of a fake coverage package for the 'debug data' tests.""" - def __init__(self, summary, plugin_data=None): - self._summary = summary - self._plugin_data = plugin_data or {} - self.filename = "FILENAME" - self.data = self - - # package members - def coverage(self, *unused_args, **unused_kwargs): - """The coverage class in the package.""" - return self - - # coverage methods - def load(self): - """Fake coverage().load()""" - pass - - # data methods - def has_arcs(self): - """Fake coverage().data.has_arcs()""" - return False - - def summary(self, fullpath): # pylint: disable=unused-argument - """Fake coverage().data.summary()""" - return self._summary - - def plugin_data(self): - """Fake coverage().data.plugin_data()""" - return self._plugin_data - - class CmdLineTest(BaseCmdLineTest): """Tests of the coverage.py command line.""" @@ -213,11 +185,33 @@ class CmdLineTest(BaseCmdLineTest): """) def test_combine(self): - # coverage combine + # coverage combine with args + self.cmd_executes("combine datadir1", """\ + .coverage() + .load() + .combine(["datadir1"]) + .save() + """) + # coverage combine without args self.cmd_executes("combine", """\ .coverage() .load() - .combine() + .combine(None) + .save() + """) + + def test_combine_doesnt_confuse_options_with_args(self): + # https://bitbucket.org/ned/coveragepy/issues/385/coverage-combine-doesnt-work-with-rcfile + self.cmd_executes("combine --rcfile cov.ini", """\ + .coverage(config_file='cov.ini') + .load() + .combine(None) + .save() + """) + self.cmd_executes("combine --rcfile cov.ini data1 data2/more", """\ + .coverage(config_file='cov.ini') + .load() + .combine(["data1", "data2/more"]) .save() """) @@ -225,36 +219,6 @@ class CmdLineTest(BaseCmdLineTest): self.cmd_help("debug", "What information would you like: data, sys?") self.cmd_help("debug foo", "Don't know what you mean by 'foo'") - def test_debug_data(self): - fake = FakeCoverageForDebugData( - summary={ - 'file1.py': 17, 'file2.py': 23, - }, - plugin_data={ - 'file1.py': 'a_plugin', - }, - ) - self.command_line("debug data", _covpkg=fake) - self.assertMultiLineEqual(self.stdout(), textwrap.dedent("""\ - -- data ------------------------------------------------------ - path: FILENAME - has_arcs: False - - 2 files: - file1.py: 17 lines [a_plugin] - file2.py: 23 lines - """)) - - def test_debug_data_with_no_data(self): - fake = FakeCoverageForDebugData(summary={}) - self.command_line("debug data", _covpkg=fake) - self.assertMultiLineEqual(self.stdout(), textwrap.dedent("""\ - -- data ------------------------------------------------------ - path: FILENAME - has_arcs: False - No data collected - """)) - def test_debug_sys(self): self.command_line("debug sys") out = self.stdout() @@ -386,10 +350,10 @@ class CmdLineTest(BaseCmdLineTest): # run -a calls coverage.load first without erasing. self.cmd_executes("run -a foo.py", """\ .coverage() - .load() .start() .run_python_file('foo.py', ['foo.py']) .stop() + .combine(data_paths=['.coverage']) .save() """) # --timid sets a flag, and program arguments get passed through. @@ -518,6 +482,14 @@ class CmdLineTest(BaseCmdLineTest): """) self.cmd_executes_same("run -m mymodule", "run --module mymodule") + def test_run_nothing(self): + self.command_line("run", ret=ERR) + self.assertIn("Nothing to do", self.stdout()) + + def test_cant_append_parallel(self): + self.command_line("run --append --parallel-mode foo.py", ret=ERR) + self.assertIn("Can't append to data files in parallel mode.", self.stdout()) + def test_xml(self): # coverage xml [-i] [--omit DIR,...] [FILE1 FILE2 ...] self.cmd_executes("xml", """\ @@ -568,6 +540,43 @@ class CmdLineTest(BaseCmdLineTest): self.cmd_help("xyzzy", "Unknown command: 'xyzzy'") +class CmdLineWithFilesTest(BaseCmdLineTest): + """Test the command line in ways that need temp files.""" + + run_in_temp_dir = True + no_files_in_temp_dir = True + + def test_debug_data(self): + data = CoverageData() + data.set_lines({ + "file1.py": dict.fromkeys(range(1, 18)), + "file2.py": dict.fromkeys(range(1, 24)), + }) + data.set_file_tracers({"file1.py": "a_plugin"}) + data_files = CoverageDataFiles() + data_files.write(data) + + self.command_line("debug data") + self.assertMultiLineEqual(self.stdout(), textwrap.dedent("""\ + -- data ------------------------------------------------------ + path: FILENAME + has_arcs: False + + 2 files: + file1.py: 17 lines [a_plugin] + file2.py: 23 lines + """).replace("FILENAME", data_files.filename)) + + def test_debug_data_with_no_data(self): + data_files = CoverageDataFiles() + self.command_line("debug data") + self.assertMultiLineEqual(self.stdout(), textwrap.dedent("""\ + -- data ------------------------------------------------------ + path: FILENAME + No data collected + """).replace("FILENAME", data_files.filename)) + + class CmdLineStdoutTest(BaseCmdLineTest): """Test the command line with real stdout output.""" diff --git a/tests/test_collector.py b/tests/test_collector.py index 26360091..bd963415 100644 --- a/tests/test_collector.py +++ b/tests/test_collector.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests of coverage/collector.py and other collectors.""" import os.path @@ -35,7 +38,7 @@ class CollectorTest(CoverageTest): # Trace one file, but not the other. CheckUniqueFilenames will assert # that _should_trace hasn't been called twice for the same file. - cov = coverage.coverage(include=["f1.py"]) + cov = coverage.Coverage(include=["f1.py"]) should_trace_hook = CheckUniqueFilenames.hook(cov, '_should_trace') # Import the Python file, executing it. diff --git a/tests/test_concurrency.py b/tests/test_concurrency.py index 93809dff..f6af0e8a 100644 --- a/tests/test_concurrency.py +++ b/tests/test_concurrency.py @@ -1,11 +1,13 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for concurrency libraries.""" -import os -import os.path import threading import coverage from coverage import env +from coverage.files import abs_file from tests.coveragetest import CoverageTest @@ -148,13 +150,13 @@ class ConcurrencyTest(CoverageTest): data.read_file(".coverage") # If the test fails, it's helpful to see this info: - fname = os.path.abspath("try_it.py") - linenos = data.executed_lines(fname).keys() + fname = abs_file("try_it.py") + linenos = data.lines(fname) print("{0}: {1}".format(len(linenos), linenos)) print_simple_annotation(code, linenos) lines = line_count(code) - self.assertEqual(data.summary()['try_it.py'], lines) + self.assertEqual(data.line_counts()['try_it.py'], lines) else: expected_out = ( "Can't support concurrency=%s with PyTracer, " diff --git a/tests/test_config.py b/tests/test_config.py index 58615f6c..9d3c95dc 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,7 @@ -# -*- coding: utf-8 -*- +# coding: utf-8 +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Test the config file handling for coverage.py""" import sys @@ -15,14 +18,14 @@ class ConfigTest(CoverageTest): def test_default_config(self): # Just constructing a coverage() object gets the right defaults. - cov = coverage.coverage() + cov = coverage.Coverage() self.assertFalse(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, ".coverage") def test_arguments(self): # Arguments to the constructor are applied to the configuration. - cov = coverage.coverage(timid=True, data_file="fooey.dat") + cov = coverage.Coverage(timid=True, data_file="fooey.dat") self.assertTrue(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, "fooey.dat") @@ -35,7 +38,7 @@ class ConfigTest(CoverageTest): timid = True data_file = .hello_kitty.data """) - cov = coverage.coverage() + cov = coverage.Coverage() self.assertTrue(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, ".hello_kitty.data") @@ -48,7 +51,7 @@ class ConfigTest(CoverageTest): ; I wouldn't really use this as a data file... data_file = delete.me """) - cov = coverage.coverage(config_file="my_cov.ini") + cov = coverage.Coverage(config_file="my_cov.ini") self.assertTrue(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, "delete.me") @@ -60,7 +63,7 @@ class ConfigTest(CoverageTest): timid = True data_file = delete.me """) - cov = coverage.coverage(config_file=False) + cov = coverage.Coverage(config_file=False) self.assertFalse(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, ".coverage") @@ -72,7 +75,7 @@ class ConfigTest(CoverageTest): timid = True data_file = weirdo.file """) - cov = coverage.coverage(timid=False, data_file=".mycov") + cov = coverage.Coverage(timid=False, data_file=".mycov") self.assertFalse(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, ".mycov") @@ -85,10 +88,10 @@ class ConfigTest(CoverageTest): data_file = weirdo.file """) self.set_environ("COVERAGE_FILE", "fromenv.dat") - cov = coverage.coverage() + cov = coverage.Coverage() self.assertEqual(cov.config.data_file, "fromenv.dat") # But the constructor arguments override the environment variable. - cov = coverage.coverage(data_file="fromarg.dat") + cov = coverage.Coverage(data_file="fromarg.dat") self.assertEqual(cov.config.data_file, "fromarg.dat") def test_parse_errors(self): @@ -99,21 +102,21 @@ class ConfigTest(CoverageTest): ("[run\n", r"\[run"), ("[report]\nexclude_lines = foo(\n", r"Invalid \[report\].exclude_lines value 'foo\(': " - r"unbalanced parenthesis"), + r"(unbalanced parenthesis|missing \))"), ("[report]\npartial_branches = foo[\n", r"Invalid \[report\].partial_branches value 'foo\[': " - r"unexpected end of regular expression"), + r"(unexpected end of regular expression|unterminated character set)"), ("[report]\npartial_branches_always = foo***\n", r"Invalid \[report\].partial_branches_always value " - r"'foo\*\*\*': " - r"multiple repeat"), - ] + r"'foo\*\*\*': " + r"multiple repeat"), + ] for bad_config, msg in bad_configs_and_msgs: print("Trying %r" % bad_config) self.make_file(".coveragerc", bad_config) with self.assertRaisesRegex(CoverageException, msg): - coverage.coverage() + coverage.Coverage() def test_environment_vars_in_config(self): # Config files can have $envvars in them. @@ -132,16 +135,17 @@ class ConfigTest(CoverageTest): self.set_environ("DATA_FILE", "hello-world") self.set_environ("THING", "ZZZ") self.set_environ("OKAY", "yes") - cov = coverage.coverage() + cov = coverage.Coverage() self.assertEqual(cov.config.data_file, "hello-world.fooey") self.assertEqual(cov.config.branch, True) - self.assertEqual(cov.config.exclude_list, + self.assertEqual( + cov.config.exclude_list, ["the_$one", "anotherZZZ", "xZZZy", "xy", "huh${X}what"] - ) + ) def test_tweaks_after_constructor(self): # Arguments to the constructor are applied to the configuration. - cov = coverage.coverage(timid=True, data_file="fooey.dat") + cov = coverage.Coverage(timid=True, data_file="fooey.dat") cov.config["run:timid"] = False self.assertFalse(cov.config.timid) @@ -154,7 +158,7 @@ class ConfigTest(CoverageTest): def test_tweak_error_checking(self): # Trying to set an unknown config value raises an error. - cov = coverage.coverage() + cov = coverage.Coverage() with self.assertRaises(CoverageException): cov.config["run:xyzzy"] = 12 with self.assertRaises(CoverageException): @@ -166,7 +170,7 @@ class ConfigTest(CoverageTest): def test_tweak_plugin_options(self): # Plugin options have a more flexible syntax. - cov = coverage.coverage() + cov = coverage.Coverage() cov.config["run:plugins"] = ["fooey.plugin", "xyzzy.coverage.plugin"] cov.config["fooey.plugin:xyzzy"] = 17 cov.config["xyzzy.coverage.plugin:plugh"] = ["a", "b"] @@ -178,6 +182,33 @@ class ConfigTest(CoverageTest): with self.assertRaises(CoverageException): _ = cov.config["no_such.plugin:foo"] + def test_unknown_option(self): + self.make_file(".coveragerc", """\ + [run] + xyzzy = 17 + """) + msg = r"Unrecognized option '\[run\] xyzzy=' in config file .coveragerc" + with self.assertRaisesRegex(CoverageException, msg): + _ = coverage.Coverage() + + def test_misplaced_option(self): + self.make_file(".coveragerc", """\ + [report] + branch = True + """) + msg = r"Unrecognized option '\[report\] branch=' in config file .coveragerc" + with self.assertRaisesRegex(CoverageException, msg): + _ = coverage.Coverage() + + def test_unknown_option_in_other_ini_file(self): + self.make_file("setup.cfg", """\ + [coverage:run] + huh = what? + """) + msg = r"Unrecognized option '\[coverage:run\] huh=' in config file setup.cfg" + with self.assertRaisesRegex(CoverageException, msg): + _ = coverage.Coverage() + class ConfigFileTest(CoverageTest): """Tests of the config file settings in particular.""" @@ -270,25 +301,15 @@ class ConfigFileTest(CoverageTest): self.assertTrue(cov.config.parallel) self.assertEqual(cov.config.concurrency, "thread") - self.assertEqual(cov.get_exclude_list(), - ["if 0:", r"pragma:?\s+no cover", "another_tab"] - ) + self.assertEqual(cov.get_exclude_list(), ["if 0:", r"pragma:?\s+no cover", "another_tab"]) self.assertTrue(cov.config.ignore_errors) self.assertEqual(cov.config.include, ["a/", "b/"]) - self.assertEqual(cov.config.omit, - ["one", "another", "some_more", "yet_more"] - ) + self.assertEqual(cov.config.omit, ["one", "another", "some_more", "yet_more"]) self.assertEqual(cov.config.precision, 3) - self.assertEqual(cov.config.partial_list, - [r"pragma:?\s+no branch"] - ) - self.assertEqual(cov.config.partial_always_list, - ["if 0:", "while True:"] - ) - self.assertEqual(cov.config.plugins, - ["plugins.a_plugin", "plugins.another"] - ) + self.assertEqual(cov.config.partial_list, [r"pragma:?\s+no branch"]) + self.assertEqual(cov.config.partial_always_list, ["if 0:", "while True:"]) + self.assertEqual(cov.config.plugins, ["plugins.a_plugin", "plugins.another"]) self.assertTrue(cov.config.show_missing) self.assertTrue(cov.config.skip_covered) self.assertEqual(cov.config.html_dir, r"c:\tricky\dir.somewhere") @@ -301,17 +322,17 @@ class ConfigFileTest(CoverageTest): self.assertEqual(cov.config.paths, { 'source': ['.', '/home/ned/src/'], 'other': ['other', '/home/ned/other', 'c:\\Ned\\etc'] - }) + }) self.assertEqual(cov.config.get_plugin_options("plugins.a_plugin"), { 'hello': 'world', 'names': 'Jane/John/Jenny', - }) + }) self.assertEqual(cov.config.get_plugin_options("plugins.another"), {}) def test_config_file_settings(self): self.make_file(".coveragerc", self.LOTSA_SETTINGS.format(section="")) - cov = coverage.coverage() + cov = coverage.Coverage() self.assert_config_settings_are_correct(cov) def test_config_file_settings_in_setupcfg(self): @@ -319,7 +340,7 @@ class ConfigFileTest(CoverageTest): # "coverage:" nested = self.LOTSA_SETTINGS.format(section="coverage:") self.make_file("setup.cfg", nested + "\n" + self.SETUP_CFG) - cov = coverage.coverage() + cov = coverage.Coverage() self.assert_config_settings_are_correct(cov) def test_config_file_settings_in_setupcfg_if_coveragerc_specified(self): @@ -328,7 +349,7 @@ class ConfigFileTest(CoverageTest): # .coveragerc file. nested = self.LOTSA_SETTINGS.format(section="coverage:") self.make_file("setup.cfg", nested + "\n" + self.SETUP_CFG) - cov = coverage.coverage(config_file=".coveragerc") + cov = coverage.Coverage(config_file=".coveragerc") self.assert_config_settings_are_correct(cov) def test_setupcfg_only_if_not_coveragerc(self): @@ -341,7 +362,7 @@ class ConfigFileTest(CoverageTest): omit = bar branch = true """) - cov = coverage.coverage() + cov = coverage.Coverage() self.assertEqual(cov.config.include, ["foo"]) self.assertEqual(cov.config.omit, None) self.assertEqual(cov.config.branch, False) @@ -352,7 +373,7 @@ class ConfigFileTest(CoverageTest): omit = bar branch = true """) - cov = coverage.coverage() + cov = coverage.Coverage() self.assertEqual(cov.config.omit, None) self.assertEqual(cov.config.branch, False) @@ -361,11 +382,9 @@ class ConfigFileTest(CoverageTest): [html] title = tabblo & «ταБЬℓσ» # numbers """) - cov = coverage.coverage() + cov = coverage.Coverage() - self.assertEqual(cov.config.html_title, - "tabblo & «ταБЬℓσ» # numbers" - ) + self.assertEqual(cov.config.html_title, "tabblo & «ταБЬℓσ» # numbers") def test_unreadable_config(self): # If a config file is explicitly specified, then it is an error for it @@ -373,14 +392,14 @@ class ConfigFileTest(CoverageTest): bad_files = [ "nosuchfile.txt", ".", - ] + ] for bad_file in bad_files: msg = "Couldn't read %r as a config file" % bad_file with self.assertRaisesRegex(CoverageException, msg): - coverage.coverage(config_file=bad_file) + coverage.Coverage(config_file=bad_file) def test_nocoveragerc_file_when_specified(self): - cov = coverage.coverage(config_file=".coveragerc") + cov = coverage.Coverage(config_file=".coveragerc") self.assertFalse(cov.config.timid) self.assertFalse(cov.config.branch) self.assertEqual(cov.config.data_file, ".coverage") diff --git a/tests/test_coverage.py b/tests/test_coverage.py index 35c7c25c..e2f0a614 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -1,5 +1,7 @@ -"""Tests for Coverage.""" -# http://nedbatchelder.com/code/coverage +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py.""" import coverage from coverage import env @@ -1424,7 +1426,7 @@ class ExcludeTest(CoverageTest): [1,2,3,4,5,6,9], "", excludes=['#pragma: NO COVER']) def test_excluding_if_pass(self): - # From a comment on the coverage page by Michael McNeil Forbes: + # From a comment on the coverage.py page by Michael McNeil Forbes: self.check_coverage("""\ def f(): if False: # pragma: no cover @@ -1663,8 +1665,11 @@ class ModuleTest(CoverageTest): def test_not_singleton(self): # You *can* create another coverage object. - coverage.coverage() - coverage.coverage() + coverage.Coverage() + coverage.Coverage() + + def test_old_name_and_new_name(self): + self.assertIs(coverage.coverage, coverage.Coverage) class ReportingTest(CoverageTest): @@ -1672,7 +1677,7 @@ class ReportingTest(CoverageTest): # We don't make any temp files, but we need an empty directory to run the # tests in. - run_in_temp_dir = True + no_files_in_temp_dir = True def test_no_data_to_report_on_annotate(self): # Reporting with no data produces a nice message and no output dir. @@ -1680,10 +1685,6 @@ class ReportingTest(CoverageTest): self.command_line("annotate -d ann") self.assert_doesnt_exist("ann") - # CoverageTest will yell at us for using a temp directory with no files - # made. Instead of adding a way to shut it up, just make a file. - self.make_file("touch.txt", "") - def test_no_data_to_report_on_html(self): # Reporting with no data produces a nice message and no output dir. with self.assertRaisesRegex(CoverageException, "No data to report."): diff --git a/tests/test_data.py b/tests/test_data.py index 0549a3c0..b370aa21 100644 --- a/tests/test_data.py +++ b/tests/test_data.py @@ -1,13 +1,25 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for coverage.data""" -from coverage.backward import pickle -from coverage.data import CoverageData -from coverage.files import PathAliases +import glob +import json +import os +import os.path +import re + +import mock + +from coverage.backward import iitems +from coverage.data import CoverageData, CoverageDataFiles, debug_main +from coverage.files import PathAliases, canonical_filename +from coverage.misc import CoverageException -from tests.coveragetest import CoverageTest +from tests.coveragetest import CoverageTest, DebugControlString -DATA_1 = { +LINES_1 = { 'a.py': {1: None, 2: None}, 'b.py': {3: None}, } @@ -16,141 +28,701 @@ MEASURED_FILES_1 = ['a.py', 'b.py'] A_PY_LINES_1 = [1, 2] B_PY_LINES_1 = [3] -DATA_2 = { +LINES_2 = { 'a.py': {1: None, 5: None}, 'c.py': {17: None}, } SUMMARY_1_2 = {'a.py': 3, 'b.py': 1, 'c.py': 1} MEASURED_FILES_1_2 = ['a.py', 'b.py', 'c.py'] -ARC_DATA_3 = { +ARCS_3 = { 'x.py': { + (-1, 1): None, (1, 2): None, (2, 3): None, + (3, -1): None, }, 'y.py': { + (-1, 17): None, (17, 23): None, + (23, -1): None, }, } -X_PY_ARCS_3 = [(1, 2), (2, 3)] -Y_PY_ARCS_3 = [(17, 23)] +X_PY_ARCS_3 = [(-1, 1), (1, 2), (2, 3), (3, -1)] +Y_PY_ARCS_3 = [(-1, 17), (17, 23), (23, -1)] +SUMMARY_3 = {'x.py': 3, 'y.py': 2} +MEASURED_FILES_3 = ['x.py', 'y.py'] +X_PY_LINES_3 = [1, 2, 3] +Y_PY_LINES_3 = [17, 23] +ARCS_4 = { + 'x.py': { + (-1, 2): None, + (2, 5): None, + (5, -1): None, + }, + 'z.py': { + (-1, 1000): None, + (1000, -1): None, + }, +} +SUMMARY_3_4 = {'x.py': 5, 'y.py': 2, 'z.py': 1} +MEASURED_FILES_3_4 = ['x.py', 'y.py', 'z.py'] -class DataTest(CoverageTest): - """Test cases for coverage.data.""" - run_in_temp_dir = False +class DataTestHelpers(CoverageTest): + """Test helpers for data tests.""" - def assert_summary(self, covdata, summary, fullpath=False): - """Check that the summary of `covdata` is `summary`.""" - self.assertEqual(covdata.summary(fullpath), summary) + def assert_line_counts(self, covdata, line_counts, fullpath=False): + """Check that the line_counts of `covdata` is `line_counts`.""" + self.assertEqual(covdata.line_counts(fullpath), line_counts) def assert_measured_files(self, covdata, measured): """Check that `covdata`'s measured files are `measured`.""" self.assertCountEqual(covdata.measured_files(), measured) - def test_reading_empty(self): + +class CoverageDataTest(DataTestHelpers, CoverageTest): + """Test cases for CoverageData.""" + + run_in_temp_dir = False + + def test_empty_data_is_false(self): + covdata = CoverageData() + self.assertFalse(covdata) + + def test_line_data_is_true(self): + covdata = CoverageData() + covdata.set_lines(LINES_1) + self.assertTrue(covdata) + + def test_arc_data_is_true(self): covdata = CoverageData() - covdata.read() - self.assert_summary(covdata, {}) + covdata.set_arcs(ARCS_3) + self.assertTrue(covdata) - def test_adding_data(self): + def test_adding_lines(self): covdata = CoverageData() - covdata.add_line_data(DATA_1) - self.assert_summary(covdata, SUMMARY_1) + covdata.set_lines(LINES_1) + self.assert_line_counts(covdata, SUMMARY_1) self.assert_measured_files(covdata, MEASURED_FILES_1) + self.assertCountEqual(covdata.lines("a.py"), A_PY_LINES_1) + self.assertFalse(covdata.has_arcs()) - def test_touch_file(self): + def test_adding_arcs(self): covdata = CoverageData() - covdata.add_line_data(DATA_1) - covdata.touch_file('x.py') - self.assert_measured_files(covdata, MEASURED_FILES_1 + ['x.py']) + covdata.set_arcs(ARCS_3) + self.assert_line_counts(covdata, SUMMARY_3) + self.assert_measured_files(covdata, MEASURED_FILES_3) + self.assertCountEqual(covdata.lines("x.py"), X_PY_LINES_3) + self.assertCountEqual(covdata.arcs("x.py"), X_PY_ARCS_3) + self.assertCountEqual(covdata.lines("y.py"), Y_PY_LINES_3) + self.assertCountEqual(covdata.arcs("y.py"), Y_PY_ARCS_3) + self.assertTrue(covdata.has_arcs()) + + def test_cant_set_arcs_with_lines(self): + covdata = CoverageData() + covdata.set_lines(LINES_1) + with self.assertRaisesRegex(CoverageException, "Can't add arcs to existing line data"): + covdata.set_arcs(ARCS_3) + + def test_cant_set_lines_with_arcs(self): + covdata = CoverageData() + covdata.set_arcs(ARCS_3) + with self.assertRaisesRegex(CoverageException, "Can't add lines to existing arc data"): + covdata.set_lines(LINES_1) + + def test_touch_file_with_lines(self): + covdata = CoverageData() + covdata.set_lines(LINES_1) + covdata.touch_file('zzz.py') + self.assert_measured_files(covdata, MEASURED_FILES_1 + ['zzz.py']) + + def test_touch_file_with_arcs(self): + covdata = CoverageData() + covdata.set_arcs(ARCS_3) + covdata.touch_file('zzz.py') + self.assert_measured_files(covdata, MEASURED_FILES_3 + ['zzz.py']) + + def test_no_lines_vs_unmeasured_file(self): + covdata = CoverageData() + covdata.set_lines(LINES_1) + covdata.touch_file('zzz.py') + self.assertEqual(covdata.lines('zzz.py'), []) + self.assertIsNone(covdata.lines('no_such_file.py')) + + def test_run_info(self): + covdata = CoverageData() + self.assertEqual(covdata.run_infos(), []) + covdata.add_run_info(hello="there") + self.assertEqual(covdata.run_infos(), [{"hello": "there"}]) + covdata.add_run_info(count=17) + self.assertEqual(covdata.run_infos(), [{"hello": "there", "count": 17}]) + + def test_no_arcs_vs_unmeasured_file(self): + covdata = CoverageData() + covdata.set_arcs(ARCS_3) + covdata.touch_file('zzz.py') + self.assertEqual(covdata.lines('zzz.py'), []) + self.assertIsNone(covdata.lines('no_such_file.py')) + self.assertEqual(covdata.arcs('zzz.py'), []) + self.assertIsNone(covdata.arcs('no_such_file.py')) + + def test_file_tracer_name(self): + covdata = CoverageData() + covdata.set_lines({ + "p1.foo": dict.fromkeys([1, 2, 3]), + "p2.html": dict.fromkeys([10, 11, 12]), + "main.py": dict.fromkeys([20]), + }) + covdata.set_file_tracers({"p1.foo": "p1.plugin", "p2.html": "p2.plugin"}) + self.assertEqual(covdata.file_tracer("p1.foo"), "p1.plugin") + self.assertEqual(covdata.file_tracer("main.py"), "") + self.assertIsNone(covdata.file_tracer("p3.not_here")) + + def test_cant_file_tracer_unmeasured_files(self): + covdata = CoverageData() + msg = "Can't add file tracer data for unmeasured file 'p1.foo'" + with self.assertRaisesRegex(CoverageException, msg): + covdata.set_file_tracers({"p1.foo": "p1.plugin"}) + + covdata.set_lines({"p2.html": dict.fromkeys([10, 11, 12])}) + with self.assertRaisesRegex(CoverageException, msg): + covdata.set_file_tracers({"p1.foo": "p1.plugin"}) + + def test_cant_change_file_tracer_name(self): + covdata = CoverageData() + covdata.set_lines({"p1.foo": dict.fromkeys([1, 2, 3])}) + covdata.set_file_tracers({"p1.foo": "p1.plugin"}) + + msg = "Conflicting file tracer name for 'p1.foo': 'p1.plugin' vs 'p1.plugin.foo'" + with self.assertRaisesRegex(CoverageException, msg): + covdata.set_file_tracers({"p1.foo": "p1.plugin.foo"}) + + def test_update_lines(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + + covdata2 = CoverageData() + covdata2.set_lines(LINES_2) + + covdata3 = CoverageData() + covdata3.update(covdata1) + covdata3.update(covdata2) + + self.assert_line_counts(covdata3, SUMMARY_1_2) + self.assert_measured_files(covdata3, MEASURED_FILES_1_2) + self.assertEqual(covdata3.run_infos(), []) + + def test_update_arcs(self): + covdata1 = CoverageData() + covdata1.set_arcs(ARCS_3) + + covdata2 = CoverageData() + covdata2.set_arcs(ARCS_4) + + covdata3 = CoverageData() + covdata3.update(covdata1) + covdata3.update(covdata2) + + self.assert_line_counts(covdata3, SUMMARY_3_4) + self.assert_measured_files(covdata3, MEASURED_FILES_3_4) + self.assertEqual(covdata3.run_infos(), []) + + def test_update_run_info(self): + covdata1 = CoverageData() + covdata1.set_arcs(ARCS_3) + covdata1.add_run_info(hello="there", count=17) + + covdata2 = CoverageData() + covdata2.set_arcs(ARCS_4) + covdata2.add_run_info(hello="goodbye", count=23) + + covdata3 = CoverageData() + covdata3.update(covdata1) + covdata3.update(covdata2) + + self.assertEqual(covdata3.run_infos(), [ + {'hello': 'there', 'count': 17}, + {'hello': 'goodbye', 'count': 23}, + ]) + + def test_update_cant_mix_lines_and_arcs(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + + covdata2 = CoverageData() + covdata2.set_arcs(ARCS_3) + + with self.assertRaisesRegex(CoverageException, "Can't combine arc data with line data"): + covdata1.update(covdata2) + + with self.assertRaisesRegex(CoverageException, "Can't combine line data with arc data"): + covdata2.update(covdata1) + + def test_update_file_tracers(self): + covdata1 = CoverageData() + covdata1.set_lines({ + "p1.html": dict.fromkeys([1, 2, 3, 4]), + "p2.html": dict.fromkeys([5, 6, 7]), + "main.py": dict.fromkeys([10, 11, 12]), + }) + covdata1.set_file_tracers({ + "p1.html": "html.plugin", + "p2.html": "html.plugin2", + }) + + covdata2 = CoverageData() + covdata2.set_lines({ + "p1.html": dict.fromkeys([3, 4, 5, 6]), + "p2.html": dict.fromkeys([7, 8, 9]), + "p3.foo": dict.fromkeys([1000, 1001]), + "main.py": dict.fromkeys([10, 11, 12]), + }) + covdata2.set_file_tracers({ + "p1.html": "html.plugin", + "p2.html": "html.plugin2", + "p3.foo": "foo_plugin", + }) + + covdata3 = CoverageData() + covdata3.update(covdata1) + covdata3.update(covdata2) + self.assertEqual(covdata3.file_tracer("p1.html"), "html.plugin") + self.assertEqual(covdata3.file_tracer("p2.html"), "html.plugin2") + self.assertEqual(covdata3.file_tracer("p3.foo"), "foo_plugin") + self.assertEqual(covdata3.file_tracer("main.py"), "") + + def test_update_conflicting_file_tracers(self): + covdata1 = CoverageData() + covdata1.set_lines({"p1.html": dict.fromkeys([1, 2, 3])}) + covdata1.set_file_tracers({"p1.html": "html.plugin"}) + + covdata2 = CoverageData() + covdata2.set_lines({"p1.html": dict.fromkeys([1, 2, 3])}) + covdata2.set_file_tracers({"p1.html": "html.other_plugin"}) + + msg = "Conflicting file tracer name for 'p1.html': 'html.plugin' vs 'html.other_plugin'" + with self.assertRaisesRegex(CoverageException, msg): + covdata1.update(covdata2) + + msg = "Conflicting file tracer name for 'p1.html': 'html.other_plugin' vs 'html.plugin'" + with self.assertRaisesRegex(CoverageException, msg): + covdata2.update(covdata1) + + def test_update_file_tracer_vs_no_file_tracer(self): + covdata1 = CoverageData() + covdata1.set_lines({"p1.html": dict.fromkeys([1, 2, 3])}) + covdata1.set_file_tracers({"p1.html": "html.plugin"}) + + covdata2 = CoverageData() + covdata2.set_lines({"p1.html": dict.fromkeys([1, 2, 3])}) + + msg = "Conflicting file tracer name for 'p1.html': 'html.plugin' vs ''" + with self.assertRaisesRegex(CoverageException, msg): + covdata1.update(covdata2) + + msg = "Conflicting file tracer name for 'p1.html': '' vs 'html.plugin'" + with self.assertRaisesRegex(CoverageException, msg): + covdata2.update(covdata1) + + def test_add_to_hash_with_lines(self): + covdata = CoverageData() + covdata.set_lines(LINES_1) + hasher = mock.Mock() + covdata.add_to_hash("a.py", hasher) + self.assertEqual(hasher.method_calls, [ + mock.call.update([1, 2]), # lines + mock.call.update(""), # file_tracer name + ]) + + def test_add_to_hash_with_arcs(self): + covdata = CoverageData() + covdata.set_arcs(ARCS_3) + covdata.set_file_tracers({"y.py": "hologram_plugin"}) + hasher = mock.Mock() + covdata.add_to_hash("y.py", hasher) + self.assertEqual(hasher.method_calls, [ + mock.call.update([(-1, 17), (17, 23), (23, -1)]), # arcs + mock.call.update("hologram_plugin"), # file_tracer name + ]) + + +class CoverageDataTestInTempDir(DataTestHelpers, CoverageTest): + """Tests of CoverageData that need a temp dir to make files.""" + + def test_read_write_lines(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + covdata1.write_file("lines.dat") + + covdata2 = CoverageData() + covdata2.read_file("lines.dat") + self.assert_line_counts(covdata2, SUMMARY_1) + self.assert_measured_files(covdata2, MEASURED_FILES_1) + self.assertCountEqual(covdata2.lines("a.py"), A_PY_LINES_1) + self.assertEqual(covdata2.run_infos(), []) + + def test_read_write_arcs(self): + covdata1 = CoverageData() + covdata1.set_arcs(ARCS_3) + covdata1.write_file("arcs.dat") + + covdata2 = CoverageData() + covdata2.read_file("arcs.dat") + self.assert_line_counts(covdata2, SUMMARY_3) + self.assert_measured_files(covdata2, MEASURED_FILES_3) + self.assertCountEqual(covdata2.lines("x.py"), X_PY_LINES_3) + self.assertCountEqual(covdata2.arcs("x.py"), X_PY_ARCS_3) + self.assertCountEqual(covdata2.lines("y.py"), Y_PY_LINES_3) + self.assertCountEqual(covdata2.arcs("y.py"), Y_PY_ARCS_3) + self.assertEqual(covdata2.run_infos(), []) + + def test_read_errors(self): + covdata = CoverageData() + + msg = r"Couldn't read data from '{0}': \S+" + self.make_file("xyzzy.dat", "xyzzy") + with self.assertRaisesRegex(CoverageException, msg.format("xyzzy.dat")): + covdata.read_file("xyzzy.dat") + + self.make_file("empty.dat", "") + with self.assertRaisesRegex(CoverageException, msg.format("empty.dat")): + covdata.read_file("empty.dat") + + with self.assertRaisesRegex(CoverageException, msg.format("nonexistent.dat")): + covdata.read_file("nonexistent.dat") + + self.make_file("misleading.dat", CoverageData._GO_AWAY + " this isn't JSON") + with self.assertRaisesRegex(CoverageException, msg.format("misleading.dat")): + covdata.read_file("misleading.dat") + + # After all that, no data should be in our CoverageData. + self.assertFalse(covdata) + + def test_debug_main(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + covdata1.write_file(".coverage") + debug_main([]) + + covdata2 = CoverageData() + covdata2.set_arcs(ARCS_3) + covdata2.set_file_tracers({"y.py": "magic_plugin"}) + covdata2.add_run_info(version="v3.14", chunks=["z", "a"]) + covdata2.write_file("arcs.dat") + + covdata3 = CoverageData() + covdata3.write_file("empty.dat") + debug_main(["arcs.dat", "empty.dat"]) + + expected = { + ".coverage": { + "lines": { + "a.py": [1, 2], + "b.py": [3], + }, + }, + "arcs.dat": { + "arcs": { + "x.py": [[-1, 1], [1, 2], [2, 3], [3, -1]], + "y.py": [[-1, 17], [17, 23], [23, -1]], + }, + "file_tracers": {"y.py": "magic_plugin"}, + "runs": [ + { + "chunks": ["z", "a"], + "version": "v3.14", + }, + ], + }, + "empty.dat": {"lines": {}}, + } + pieces = re.split(r"(?m)-+ ([\w.]+) -+$", self.stdout()) + for name, json_out in zip(pieces[1::2], pieces[2::2]): + json_got = json.loads(json_out) + canonicalize_json_data(json_got) + self.assertEqual(expected[name], json_got) + + +def canonicalize_json_data(data): + """Canonicalize our JSON data so it can be compared.""" + for fname, lines in iitems(data.get('lines', {})): + data['lines'][fname] = sorted(lines) + for fname, arcs in iitems(data.get('arcs', {})): + data['arcs'][fname] = sorted(arcs) + + +class CoverageDataFilesTest(DataTestHelpers, CoverageTest): + """Tests of CoverageDataFiles.""" + + no_files_in_temp_dir = True + + def setUp(self): + super(CoverageDataFilesTest, self).setUp() + self.data_files = CoverageDataFiles() + + def test_reading_missing(self): + self.assert_doesnt_exist(".coverage") + covdata = CoverageData() + self.data_files.read(covdata) + self.assert_line_counts(covdata, {}) def test_writing_and_reading(self): covdata1 = CoverageData() - covdata1.add_line_data(DATA_1) - covdata1.write() + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1) covdata2 = CoverageData() - covdata2.read() - self.assert_summary(covdata2, SUMMARY_1) + self.data_files.read(covdata2) + self.assert_line_counts(covdata2, SUMMARY_1) + + def test_debug_output_with_debug_option(self): + # With debug option dataio, we get debug output about reading and + # writing files. + debug = DebugControlString(options=["dataio"]) + covdata1 = CoverageData(debug=debug) + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1) + + covdata2 = CoverageData(debug=debug) + self.data_files.read(covdata2) + self.assert_line_counts(covdata2, SUMMARY_1) + + self.assertRegex( + debug.get_output(), + r"^Writing data to '.*\.coverage'\n" + r"Reading data from '.*\.coverage'\n$" + ) + + def test_debug_output_without_debug_option(self): + # With a debug object, but not the dataio option, we don't get debug + # output. + debug = DebugControlString(options=[]) + covdata1 = CoverageData(debug=debug) + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1) + + covdata2 = CoverageData(debug=debug) + self.data_files.read(covdata2) + self.assert_line_counts(covdata2, SUMMARY_1) + + self.assertEqual(debug.get_output(), "") + + def test_explicit_suffix(self): + self.assert_doesnt_exist(".coverage.SUFFIX") + covdata = CoverageData() + covdata.set_lines(LINES_1) + self.data_files.write(covdata, suffix='SUFFIX') + self.assert_exists(".coverage.SUFFIX") + self.assert_doesnt_exist(".coverage") + + def test_true_suffix(self): + self.assertEqual(glob.glob(".coverage.*"), []) + + # suffix=True will make a randomly named data file. + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1, suffix=True) + self.assert_doesnt_exist(".coverage") + data_files1 = glob.glob(".coverage.*") + self.assertEqual(len(data_files1), 1) + + # Another suffix=True will choose a different name. + covdata2 = CoverageData() + covdata2.set_lines(LINES_1) + self.data_files.write(covdata2, suffix=True) + self.assert_doesnt_exist(".coverage") + data_files2 = glob.glob(".coverage.*") + self.assertEqual(len(data_files2), 2) + + # In addition to being different, the suffixes have the pid in them. + self.assertTrue(all(str(os.getpid()) in fn for fn in data_files2)) def test_combining(self): + self.assert_doesnt_exist(".coverage.1") + self.assert_doesnt_exist(".coverage.2") + covdata1 = CoverageData() - covdata1.add_line_data(DATA_1) - covdata1.write(suffix='1') + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1, suffix='1') + self.assert_exists(".coverage.1") + self.assert_doesnt_exist(".coverage.2") covdata2 = CoverageData() - covdata2.add_line_data(DATA_2) - covdata2.write(suffix='2') + covdata2.set_lines(LINES_2) + self.data_files.write(covdata2, suffix='2') + self.assert_exists(".coverage.2") covdata3 = CoverageData() - covdata3.combine_parallel_data() - self.assert_summary(covdata3, SUMMARY_1_2) + self.data_files.combine_parallel_data(covdata3) + self.assert_line_counts(covdata3, SUMMARY_1_2) self.assert_measured_files(covdata3, MEASURED_FILES_1_2) + self.assert_doesnt_exist(".coverage.1") + self.assert_doesnt_exist(".coverage.2") def test_erasing(self): covdata1 = CoverageData() - covdata1.add_line_data(DATA_1) - covdata1.write() + covdata1.set_lines(LINES_1) + self.data_files.write(covdata1) + covdata1.erase() - self.assert_summary(covdata1, {}) + self.assert_line_counts(covdata1, {}) + self.data_files.erase() covdata2 = CoverageData() - covdata2.read() - self.assert_summary(covdata2, {}) + self.data_files.read(covdata2) + self.assert_line_counts(covdata2, {}) + + def test_erasing_parallel(self): + self.make_file("datafile.1") + self.make_file("datafile.2") + self.make_file(".coverage") + data_files = CoverageDataFiles("datafile") + data_files.erase(parallel=True) + self.assert_doesnt_exist("datafile.1") + self.assert_doesnt_exist("datafile.2") + self.assert_exists(".coverage") + + def read_json_data_file(self, fname): + """Read a JSON data file for testing the JSON directly.""" + with open(fname, 'r') as fdata: + go_away = fdata.read(len(CoverageData._GO_AWAY)) + self.assertEqual(go_away, CoverageData._GO_AWAY) + return json.load(fdata) def test_file_format(self): - # Write with CoverageData, then read the pickle explicitly. + # Write with CoverageData, then read the JSON explicitly. covdata = CoverageData() - covdata.add_line_data(DATA_1) - covdata.write() + covdata.set_lines(LINES_1) + self.data_files.write(covdata) - with open(".coverage", 'rb') as fdata: - data = pickle.load(fdata) + data = self.read_json_data_file(".coverage") lines = data['lines'] self.assertCountEqual(lines.keys(), MEASURED_FILES_1) self.assertCountEqual(lines['a.py'], A_PY_LINES_1) self.assertCountEqual(lines['b.py'], B_PY_LINES_1) # If not measuring branches, there's no arcs entry. - self.assertEqual(data.get('arcs', 'not there'), 'not there') + self.assertNotIn('arcs', data) + # If no file tracers were involved, there's no file_tracers entry. + self.assertNotIn('file_tracers', data) def test_file_format_with_arcs(self): - # Write with CoverageData, then read the pickle explicitly. + # Write with CoverageData, then read the JSON explicitly. covdata = CoverageData() - covdata.add_arc_data(ARC_DATA_3) - covdata.write() + covdata.set_arcs(ARCS_3) + self.data_files.write(covdata) - with open(".coverage", 'rb') as fdata: - data = pickle.load(fdata) + data = self.read_json_data_file(".coverage") - self.assertCountEqual(data['lines'].keys(), []) + self.assertNotIn('lines', data) arcs = data['arcs'] - self.assertCountEqual(arcs['x.py'], X_PY_ARCS_3) - self.assertCountEqual(arcs['y.py'], Y_PY_ARCS_3) + self.assertCountEqual(arcs.keys(), MEASURED_FILES_3) + self.assertCountEqual(arcs['x.py'], map(list, X_PY_ARCS_3)) + self.assertCountEqual(arcs['y.py'], map(list, Y_PY_ARCS_3)) + # If no file tracers were involved, there's no file_tracers entry. + self.assertNotIn('file_tracers', data) + + def test_writing_to_other_file(self): + data_files = CoverageDataFiles(".otherfile") + covdata = CoverageData() + covdata.set_lines(LINES_1) + data_files.write(covdata) + self.assert_doesnt_exist(".coverage") + self.assert_exists(".otherfile") + + data_files.write(covdata, suffix="extra") + self.assert_exists(".otherfile.extra") + self.assert_doesnt_exist(".coverage") def test_combining_with_aliases(self): covdata1 = CoverageData() - covdata1.add_line_data({ + covdata1.set_lines({ '/home/ned/proj/src/a.py': {1: None, 2: None}, '/home/ned/proj/src/sub/b.py': {3: None}, - }) - covdata1.write(suffix='1') + '/home/ned/proj/src/template.html': {10: None}, + }) + covdata1.set_file_tracers({ + '/home/ned/proj/src/template.html': 'html.plugin', + }) + self.data_files.write(covdata1, suffix='1') covdata2 = CoverageData() - covdata2.add_line_data({ + covdata2.set_lines({ r'c:\ned\test\a.py': {4: None, 5: None}, - r'c:\ned\test\sub\b.py': {6: None}, - }) - covdata2.write(suffix='2') + r'c:\ned\test\sub\b.py': {3: None, 6: None}, + }) + self.data_files.write(covdata2, suffix='2') covdata3 = CoverageData() aliases = PathAliases() aliases.add("/home/ned/proj/src/", "./") aliases.add(r"c:\ned\test", "./") - covdata3.combine_parallel_data(aliases=aliases) - self.assert_summary( - covdata3, {'./a.py': 4, './sub/b.py': 2}, fullpath=True - ) - self.assert_measured_files(covdata3, ['./a.py', './sub/b.py']) + self.data_files.combine_parallel_data(covdata3, aliases=aliases) + + apy = canonical_filename('./a.py') + sub_bpy = canonical_filename('./sub/b.py') + template_html = canonical_filename('./template.html') + + self.assert_line_counts(covdata3, {apy: 4, sub_bpy: 2, template_html: 1}, fullpath=True) + self.assert_measured_files(covdata3, [apy, sub_bpy, template_html]) + self.assertEqual(covdata3.file_tracer(template_html), 'html.plugin') + + def test_combining_from_different_directories(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + os.makedirs('cov1') + covdata1.write_file('cov1/.coverage.1') + + covdata2 = CoverageData() + covdata2.set_lines(LINES_2) + os.makedirs('cov2') + covdata2.write_file('cov2/.coverage.2') + + # This data won't be included. + covdata_xxx = CoverageData() + covdata_xxx.set_arcs(ARCS_3) + covdata_xxx.write_file('.coverage.xxx') + + covdata3 = CoverageData() + self.data_files.combine_parallel_data(covdata3, data_paths=['cov1', 'cov2']) + + self.assert_line_counts(covdata3, SUMMARY_1_2) + self.assert_measured_files(covdata3, MEASURED_FILES_1_2) + self.assert_doesnt_exist("cov1/.coverage.1") + self.assert_doesnt_exist("cov2/.coverage.2") + self.assert_exists(".coverage.xxx") + + def test_combining_from_files(self): + covdata1 = CoverageData() + covdata1.set_lines(LINES_1) + os.makedirs('cov1') + covdata1.write_file('cov1/.coverage.1') + + covdata2 = CoverageData() + covdata2.set_lines(LINES_2) + os.makedirs('cov2') + covdata2.write_file('cov2/.coverage.2') + + # This data won't be included. + covdata_xxx = CoverageData() + covdata_xxx.set_arcs(ARCS_3) + covdata_xxx.write_file('.coverage.xxx') + covdata_xxx.write_file('cov2/.coverage.xxx') + + covdata3 = CoverageData() + self.data_files.combine_parallel_data(covdata3, data_paths=['cov1', 'cov2/.coverage.2']) + + self.assert_line_counts(covdata3, SUMMARY_1_2) + self.assert_measured_files(covdata3, MEASURED_FILES_1_2) + self.assert_doesnt_exist("cov1/.coverage.1") + self.assert_doesnt_exist("cov2/.coverage.2") + self.assert_exists(".coverage.xxx") + self.assert_exists("cov2/.coverage.xxx") + + def test_combining_from_nonexistent_directories(self): + covdata = CoverageData() + msg = "Couldn't combine from non-existent path 'xyzzy'" + with self.assertRaisesRegex(CoverageException, msg): + self.data_files.combine_parallel_data(covdata, data_paths=['xyzzy']) diff --git a/tests/test_debug.py b/tests/test_debug.py index 8dd13a57..4d9e9271 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests of coverage/debug.py""" import os @@ -61,7 +64,7 @@ class DebugTraceTest(CoverageTest): """) debug_out = StringIO() - cov = coverage.coverage(debug=debug) + cov = coverage.Coverage(debug=debug) cov._debug_file = debug_out self.start_import_stop(cov, "f1") @@ -116,7 +119,7 @@ class DebugTraceTest(CoverageTest): out_lines = self.f1_debug_output(["sys"]) labels = """ - version coverage cover_dir pylib_dirs tracer config_files + version coverage cover_dirs pylib_dirs tracer config_files configs_read data_path python platform implementation executable cwd path environment command_line cover_match pylib_match """.split() diff --git a/tests/test_execfile.py b/tests/test_execfile.py index 9c2bc7d6..2533f81d 100644 --- a/tests/test_execfile.py +++ b/tests/test_execfile.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for coverage.execfile""" import compileall diff --git a/tests/test_farm.py b/tests/test_farm.py index 92bd968a..daa83d92 100644 --- a/tests/test_farm.py +++ b/tests/test_farm.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Run tests in the farm sub-directory. Designed for nose.""" import difflib @@ -14,7 +17,7 @@ from nose.plugins.skip import SkipTest from tests.helpers import run_command from tests.backtest import execfile # pylint: disable=redefined-builtin -from coverage.control import _TEST_NAME_FILE +from coverage.debug import _TEST_NAME_FILE def test_farm(clean_only=False): @@ -228,8 +231,8 @@ class FarmTestCase(object): without triggering an assertion. `right_extra` means the right directory can. - `scrubs` is a list of pairs, regex find and replace patterns to use to - scrub the files of unimportant differences. + `scrubs` is a list of pairs, regexes to find and literal strings to + replace them with to scrub the files of unimportant differences. An assertion will be raised if the directories fail one of their matches. @@ -309,7 +312,7 @@ class FarmTestCase(object): """ for rgx_find, rgx_replace in scrubs: - strdata = re.sub(rgx_find, rgx_replace, strdata) + strdata = re.sub(rgx_find, re.escape(rgx_replace), strdata) return strdata def contains(self, filename, *strlist): diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py index 9db4c0c3..380d92d3 100644 --- a/tests/test_filereporter.py +++ b/tests/test_filereporter.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for FileReporters""" import os @@ -32,9 +35,9 @@ class FileReporterTest(CoverageTest): acu = PythonFileReporter("aa/afile.py") bcu = PythonFileReporter("aa/bb/bfile.py") ccu = PythonFileReporter("aa/bb/cc/cfile.py") - self.assertEqual(acu.name, "aa/afile.py") - self.assertEqual(bcu.name, "aa/bb/bfile.py") - self.assertEqual(ccu.name, "aa/bb/cc/cfile.py") + self.assertEqual(acu.relative_filename(), "aa/afile.py") + self.assertEqual(bcu.relative_filename(), "aa/bb/bfile.py") + self.assertEqual(ccu.relative_filename(), "aa/bb/cc/cfile.py") self.assertEqual(acu.flat_rootname(), "aa_afile_py") self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_py") self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile_py") @@ -46,9 +49,9 @@ class FileReporterTest(CoverageTest): acu = PythonFileReporter("aa/afile.odd.py") bcu = PythonFileReporter("aa/bb/bfile.odd.py") b2cu = PythonFileReporter("aa/bb.odd/bfile.py") - self.assertEqual(acu.name, "aa/afile.odd.py") - self.assertEqual(bcu.name, "aa/bb/bfile.odd.py") - self.assertEqual(b2cu.name, "aa/bb.odd/bfile.py") + self.assertEqual(acu.relative_filename(), "aa/afile.odd.py") + self.assertEqual(bcu.relative_filename(), "aa/bb/bfile.odd.py") + self.assertEqual(b2cu.relative_filename(), "aa/bb.odd/bfile.py") self.assertEqual(acu.flat_rootname(), "aa_afile_odd_py") self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_odd_py") self.assertEqual(b2cu.flat_rootname(), "aa_bb_odd_bfile_py") @@ -64,9 +67,9 @@ class FileReporterTest(CoverageTest): acu = PythonFileReporter(aa) bcu = PythonFileReporter(aa.bb) ccu = PythonFileReporter(aa.bb.cc) - self.assertEqual(acu.name, native("aa.py")) - self.assertEqual(bcu.name, native("aa/bb.py")) - self.assertEqual(ccu.name, native("aa/bb/cc.py")) + self.assertEqual(acu.relative_filename(), native("aa.py")) + self.assertEqual(bcu.relative_filename(), native("aa/bb.py")) + self.assertEqual(ccu.relative_filename(), native("aa/bb/cc.py")) self.assertEqual(acu.flat_rootname(), "aa_py") self.assertEqual(bcu.flat_rootname(), "aa_bb_py") self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_py") @@ -82,9 +85,9 @@ class FileReporterTest(CoverageTest): acu = PythonFileReporter(aa.afile) bcu = PythonFileReporter(aa.bb.bfile) ccu = PythonFileReporter(aa.bb.cc.cfile) - self.assertEqual(acu.name, native("aa/afile.py")) - self.assertEqual(bcu.name, native("aa/bb/bfile.py")) - self.assertEqual(ccu.name, native("aa/bb/cc/cfile.py")) + self.assertEqual(acu.relative_filename(), native("aa/afile.py")) + self.assertEqual(bcu.relative_filename(), native("aa/bb/bfile.py")) + self.assertEqual(ccu.relative_filename(), native("aa/bb/cc/cfile.py")) self.assertEqual(acu.flat_rootname(), "aa_afile_py") self.assertEqual(bcu.flat_rootname(), "aa_bb_bfile_py") self.assertEqual(ccu.flat_rootname(), "aa_bb_cc_cfile_py") @@ -117,4 +120,4 @@ class FileReporterTest(CoverageTest): ecu = PythonFileReporter(egg1) eecu = PythonFileReporter(egg1.egg1) self.assertEqual(ecu.source(), u"") - self.assertEqual(eecu.source().split("\n")[0], u"# My egg file!") + self.assertIn(u"# My egg file!", eecu.source().splitlines()) diff --git a/tests/test_files.py b/tests/test_files.py index ae56e728..b658853a 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -1,19 +1,24 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for files.py""" import os import os.path +from coverage import files from coverage.files import ( - FileLocator, TreeMatcher, FnmatchMatcher, ModuleMatcher, PathAliases, - find_python_files, abs_file + TreeMatcher, FnmatchMatcher, ModuleMatcher, PathAliases, + find_python_files, abs_file, actual_path ) from coverage.misc import CoverageException +from coverage import env from tests.coveragetest import CoverageTest -class FileLocatorTest(CoverageTest): - """Tests of `FileLocator`.""" +class FilesTest(CoverageTest): + """Tests of coverage.files.""" def abs_path(self, p): """Return the absolute path for `p`.""" @@ -21,11 +26,11 @@ class FileLocatorTest(CoverageTest): def test_simple(self): self.make_file("hello.py") - fl = FileLocator() - self.assertEqual(fl.relative_filename("hello.py"), "hello.py") + files.set_relative_directory() + self.assertEqual(files.relative_filename("hello.py"), "hello.py") a = self.abs_path("hello.py") self.assertNotEqual(a, "hello.py") - self.assertEqual(fl.relative_filename(a), "hello.py") + self.assertEqual(files.relative_filename(a), "hello.py") def test_peer_directories(self): self.make_file("sub/proj1/file1.py") @@ -34,20 +39,20 @@ class FileLocatorTest(CoverageTest): a2 = self.abs_path("sub/proj2/file2.py") d = os.path.normpath("sub/proj1") os.chdir(d) - fl = FileLocator() - self.assertEqual(fl.relative_filename(a1), "file1.py") - self.assertEqual(fl.relative_filename(a2), a2) + files.set_relative_directory() + self.assertEqual(files.relative_filename(a1), "file1.py") + self.assertEqual(files.relative_filename(a2), a2) def test_filepath_contains_absolute_prefix_twice(self): # https://bitbucket.org/ned/coveragepy/issue/194 # Build a path that has two pieces matching the absolute path prefix. # Technically, this test doesn't do that on Windows, but drive # letters make that impractical to achieve. - fl = FileLocator() + files.set_relative_directory() d = abs_file(os.curdir) trick = os.path.splitdrive(d)[1].lstrip(os.path.sep) rel = os.path.join('sub', trick, 'file1.py') - self.assertEqual(fl.relative_filename(abs_file(rel)), rel) + self.assertEqual(files.relative_filename(abs_file(rel)), rel) class MatcherTest(CoverageTest): @@ -55,11 +60,11 @@ class MatcherTest(CoverageTest): def setUp(self): super(MatcherTest, self).setUp() - self.fl = FileLocator() + files.set_relative_directory() def assertMatches(self, matcher, filepath, matches): """The `matcher` should agree with `matches` about `filepath`.""" - canonical = self.fl.canonical_filename(filepath) + canonical = files.canonical_filename(filepath) self.assertEqual( matcher.match(canonical), matches, "File %s should have matched as %s" % (filepath, matches) @@ -73,10 +78,9 @@ class MatcherTest(CoverageTest): (self.make_file("sub3/file4.py"), True), (self.make_file("sub3/file5.c"), False), ] - fl = FileLocator() trees = [ - fl.canonical_filename("sub"), - fl.canonical_filename("sub3/file4.py"), + files.canonical_filename("sub"), + files.canonical_filename("sub3/file4.py"), ] tm = TreeMatcher(trees) self.assertEqual(tm.info(), trees) @@ -146,34 +150,48 @@ class PathAliasesTest(CoverageTest): run_in_temp_dir = False + def assert_mapped(self, aliases, inp, out): + """Assert that `inp` mapped through `aliases` produces `out`. + + `out` is canonicalized first, since aliases always produce + canonicalized paths. + + """ + self.assertEqual(aliases.map(inp), files.canonical_filename(out)) + + def assert_not_mapped(self, aliases, inp): + """Assert that `inp` mapped through `aliases` is unchanged.""" + self.assertEqual(aliases.map(inp), inp) + def test_noop(self): aliases = PathAliases() - self.assertEqual(aliases.map('/ned/home/a.py'), '/ned/home/a.py') + self.assert_not_mapped(aliases, '/ned/home/a.py') def test_nomatch(self): aliases = PathAliases() aliases.add('/home/*/src', './mysrc') - self.assertEqual(aliases.map('/home/foo/a.py'), '/home/foo/a.py') + self.assert_not_mapped(aliases, '/home/foo/a.py') def test_wildcard(self): aliases = PathAliases() aliases.add('/ned/home/*/src', './mysrc') - self.assertEqual(aliases.map('/ned/home/foo/src/a.py'), './mysrc/a.py') + self.assert_mapped(aliases, '/ned/home/foo/src/a.py', './mysrc/a.py') + aliases = PathAliases() aliases.add('/ned/home/*/src/', './mysrc') - self.assertEqual(aliases.map('/ned/home/foo/src/a.py'), './mysrc/a.py') + self.assert_mapped(aliases, '/ned/home/foo/src/a.py', './mysrc/a.py') def test_no_accidental_match(self): aliases = PathAliases() aliases.add('/home/*/src', './mysrc') - self.assertEqual(aliases.map('/home/foo/srcetc'), '/home/foo/srcetc') + self.assert_not_mapped(aliases, '/home/foo/srcetc') def test_multiple_patterns(self): aliases = PathAliases() aliases.add('/home/*/src', './mysrc') aliases.add('/lib/*/libsrc', './mylib') - self.assertEqual(aliases.map('/home/foo/src/a.py'), './mysrc/a.py') - self.assertEqual(aliases.map('/lib/foo/libsrc/a.py'), './mylib/a.py') + self.assert_mapped(aliases, '/home/foo/src/a.py', './mysrc/a.py') + self.assert_mapped(aliases, '/lib/foo/libsrc/a.py', './mylib/a.py') def test_cant_have_wildcard_at_end(self): aliases = PathAliases() @@ -189,34 +207,26 @@ class PathAliasesTest(CoverageTest): aliases = PathAliases() aliases.add(r'c:\Zoo\boo', 'src/') aliases.add('/home/ned$', 'src/') - self.assertEqual(aliases.map(r'c:\Zoo\boo\foo.py'), 'src/foo.py') - self.assertEqual(aliases.map(r'/home/ned$/foo.py'), 'src/foo.py') + self.assert_mapped(aliases, r'c:\Zoo\boo\foo.py', 'src/foo.py') + self.assert_mapped(aliases, r'/home/ned$/foo.py', 'src/foo.py') def test_paths_are_os_corrected(self): aliases = PathAliases() aliases.add('/home/ned/*/src', './mysrc') aliases.add(r'c:\ned\src', './mysrc') - mapped = aliases.map(r'C:\Ned\src\sub\a.py') - self.assertEqual(mapped, './mysrc/sub/a.py') + self.assert_mapped(aliases, r'C:\Ned\src\sub\a.py', './mysrc/sub/a.py') aliases = PathAliases() aliases.add('/home/ned/*/src', r'.\mysrc') aliases.add(r'c:\ned\src', r'.\mysrc') - mapped = aliases.map(r'/home/ned/foo/src/sub/a.py') - self.assertEqual(mapped, r'.\mysrc\sub\a.py') + self.assert_mapped(aliases, r'/home/ned/foo/src/sub/a.py', r'.\mysrc\sub\a.py') def test_leading_wildcard(self): aliases = PathAliases() aliases.add('*/d1', './mysrc1') aliases.add('*/d2', './mysrc2') - self.assertEqual(aliases.map('/foo/bar/d1/x.py'), './mysrc1/x.py') - self.assertEqual(aliases.map('/foo/bar/d2/y.py'), './mysrc2/y.py') - - -class RelativePathAliasesTest(CoverageTest): - """Tests for coverage/files.py:PathAliases, with relative files.""" - - run_in_temp_dir = False + self.assert_mapped(aliases, '/foo/bar/d1/x.py', './mysrc1/x.py') + self.assert_mapped(aliases, '/foo/bar/d2/y.py', './mysrc2/y.py') def test_dot(self): for d in ('.', '..', '../other', '~'): @@ -227,7 +237,7 @@ class RelativePathAliasesTest(CoverageTest): the_file = os.path.abspath(os.path.realpath(the_file)) assert '~' not in the_file # to be sure the test is pure. - self.assertEqual(aliases.map(the_file), '/the/source/a.py') + self.assert_mapped(aliases, the_file, '/the/source/a.py') class FindPythonFilesTest(CoverageTest): @@ -248,3 +258,17 @@ class FindPythonFilesTest(CoverageTest): "sub/ssub/__init__.py", "sub/ssub/s.py", "sub/windows.pyw", ]) + + +class WindowsFileTest(CoverageTest): + """Windows-specific tests of file name handling.""" + + run_in_temp_dir = False + + def setUp(self): + if not env.WINDOWS: + self.skip("Only need to run Windows tests on Windows.") + super(WindowsFileTest, self).setUp() + + def test_actual_path(self): + self.assertEquals(actual_path(r'c:\Windows'), actual_path(r'C:\wINDOWS')) diff --git a/tests/test_html.py b/tests/test_html.py index 004ebbfb..d9ecb678 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1,11 +1,14 @@ # -*- coding: utf-8 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests that HTML generation is awesome.""" +import datetime import os.path import re import coverage -from coverage import env import coverage.html from coverage.misc import CoverageException, NotPython, NoSource @@ -33,9 +36,9 @@ class HtmlTestHelpers(CoverageTest): """) def run_coverage(self, covargs=None, htmlargs=None): - """Run coverage on main_file.py, and create an HTML report.""" + """Run coverage.py on main_file.py, and create an HTML report.""" self.clean_local_file_imports() - cov = coverage.coverage(**(covargs or {})) + cov = coverage.Coverage(**(covargs or {})) self.start_import_stop(cov, "main_file") cov.html_report(**(htmlargs or {})) @@ -53,6 +56,21 @@ class HtmlTestHelpers(CoverageTest): with open(filename) as f: return f.read() + def get_html_index_content(self): + """Return the content of index.html. + + Timestamps are replaced with a placeholder so that clocks don't matter. + + """ + with open("htmlcov/index.html") as f: + index = f.read() + index = re.sub( + r"created at \d{4}-\d{2}-\d{2} \d{2}:\d{2}", + r"created at YYYY-MM-DD HH:MM", + index, + ) + return index + class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): """Tests of the HTML delta speed-ups.""" @@ -60,7 +78,7 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): def setUp(self): super(HtmlDeltaTest, self).setUp() - # At least one of our tests monkey-patches the version of coverage, + # At least one of our tests monkey-patches the version of coverage.py, # so grab it here to restore it later. self.real_coverage_version = coverage.__version__ self.addCleanup(self.restore_coverage_version) @@ -86,8 +104,7 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): # In this case, helper1 changes because its source is different. self.create_initial_files() self.run_coverage() - with open("htmlcov/index.html") as f: - index1 = f.read() + index1 = self.get_html_index_content() self.remove_html_files() # Now change a file and do it again @@ -104,8 +121,7 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): self.assert_exists("htmlcov/helper1_py.html") self.assert_doesnt_exist("htmlcov/main_file_py.html") self.assert_doesnt_exist("htmlcov/helper2_py.html") - with open("htmlcov/index.html") as f: - index2 = f.read() + index2 = self.get_html_index_content() self.assertMultiLineEqual(index1, index2) def test_html_delta_from_coverage_change(self): @@ -132,12 +148,11 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): def test_html_delta_from_settings_change(self): # HTML generation can create only the files that have changed. - # In this case, everything changes because the coverage settings have - # changed. + # In this case, everything changes because the coverage.py settings + # have changed. self.create_initial_files() self.run_coverage(covargs=dict(omit=[])) - with open("htmlcov/index.html") as f: - index1 = f.read() + index1 = self.get_html_index_content() self.remove_html_files() self.run_coverage(covargs=dict(omit=['xyzzy*'])) @@ -147,18 +162,16 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): self.assert_exists("htmlcov/helper1_py.html") self.assert_exists("htmlcov/main_file_py.html") self.assert_exists("htmlcov/helper2_py.html") - with open("htmlcov/index.html") as f: - index2 = f.read() + index2 = self.get_html_index_content() self.assertMultiLineEqual(index1, index2) def test_html_delta_from_coverage_version_change(self): # HTML generation can create only the files that have changed. - # In this case, everything changes because the coverage version has + # In this case, everything changes because the coverage.py version has # changed. self.create_initial_files() self.run_coverage() - with open("htmlcov/index.html") as f: - index1 = f.read() + index1 = self.get_html_index_content() self.remove_html_files() # "Upgrade" coverage.py! @@ -171,8 +184,7 @@ class HtmlDeltaTest(HtmlTestHelpers, CoverageTest): self.assert_exists("htmlcov/helper1_py.html") self.assert_exists("htmlcov/main_file_py.html") self.assert_exists("htmlcov/helper2_py.html") - with open("htmlcov/index.html") as f: - index2 = f.read() + index2 = self.get_html_index_content() fixed_index2 = index2.replace("XYZZY", self.real_coverage_version) self.assertMultiLineEqual(index1, fixed_index2) @@ -183,8 +195,7 @@ class HtmlTitleTest(HtmlTestHelpers, CoverageTest): def test_default_title(self): self.create_initial_files() self.run_coverage() - with open("htmlcov/index.html") as f: - index = f.read() + index = self.get_html_index_content() self.assertIn("<title>Coverage report</title>", index) self.assertIn("<h1>Coverage report:", index) @@ -192,8 +203,7 @@ class HtmlTitleTest(HtmlTestHelpers, CoverageTest): self.create_initial_files() self.make_file(".coveragerc", "[html]\ntitle = Metrics & stuff!\n") self.run_coverage() - with open("htmlcov/index.html") as f: - index = f.read() + index = self.get_html_index_content() self.assertIn("<title>Metrics & stuff!</title>", index) self.assertIn("<h1>Metrics & stuff!:", index) @@ -203,8 +213,7 @@ class HtmlTitleTest(HtmlTestHelpers, CoverageTest): "[html]\ntitle = «ταБЬℓσ» numbers" ) self.run_coverage() - with open("htmlcov/index.html") as f: - index = f.read() + index = self.get_html_index_content() self.assertIn( "<title>«ταБЬℓσ»" " numbers", index @@ -218,8 +227,7 @@ class HtmlTitleTest(HtmlTestHelpers, CoverageTest): self.create_initial_files() self.make_file(".coveragerc", "[html]\ntitle = Good title\n") self.run_coverage(htmlargs=dict(title="«ταБЬℓσ» & stüff!")) - with open("htmlcov/index.html") as f: - index = f.read() + index = self.get_html_index_content() self.assertIn( "<title>«ταБЬℓσ»" " & stüff!</title>", index @@ -235,7 +243,7 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): def test_dotpy_not_python(self): self.make_file("innocuous.py", "a = 1") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "innocuous") self.make_file("innocuous.py", "<h1>This isn't python!</h1>") msg = "Couldn't parse '.*innocuous.py' as Python source: .* at line 1" @@ -244,7 +252,7 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): def test_dotpy_not_python_ignored(self): self.make_file("innocuous.py", "a = 2") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "innocuous") self.make_file("innocuous.py", "<h1>This isn't python!</h1>") cov.html_report(ignore_errors=True) @@ -271,7 +279,7 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): source = "exec(compile('','','exec'), {'__file__': 'liar.html'})" self.make_file("liar.py", source) self.make_file("liar.html", "{# Whoops, not python code #}") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "liar") cov.html_report() self.assert_exists("htmlcov/index.html") @@ -284,14 +292,13 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): self.make_file("liar.py", source) # Tokenize will raise an IndentationError if it can't dedent. self.make_file("liar.html", "0\n 2\n 1\n") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "liar") cov.html_report() self.assert_exists("htmlcov/index.html") - # TODO: enable this test, and then fix this: - # https://bitbucket.org/ned/coveragepy/issue/351/files-with-incorrect-encoding-are-ignored - def SKIP_THIS_decode_error(self): + def test_decode_error(self): + # https://bitbucket.org/ned/coveragepy/issue/351/files-with-incorrect-encoding-are-ignored # imp.load_module won't load a file with an undecodable character # in a comment, though Python will run them. So we'll change the # file after running. @@ -301,7 +308,7 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): # coding: utf8 a = 1 # Isn't this great?! """) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "main") # Create the undecodable version of the file. make_file is too helpful, @@ -316,16 +323,13 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): cov.html_report() html_report = self.get_html_report_content("sub/not_ascii.py") - if env.PY2: - expected = "# Isn't this great?�!" - else: - expected = "# Isn't this great?Ë!" + expected = "# Isn't this great?�!" self.assertIn(expected, html_report) def test_formfeeds(self): # https://bitbucket.org/ned/coveragepy/issue/360/html-reports-get-confused-by-l-in-the-code self.make_file("formfeed.py", "line_one = 1\n\f\nline_two = 2\n") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "formfeed") cov.html_report() @@ -333,7 +337,7 @@ class HtmlWithUnparsableFilesTest(HtmlTestHelpers, CoverageTest): self.assertIn("line_two", formfeed_html) -class HtmlTest(CoverageTest): +class HtmlTest(HtmlTestHelpers, CoverageTest): """Moar HTML tests.""" def test_missing_source_file_incorrect_message(self): @@ -341,7 +345,7 @@ class HtmlTest(CoverageTest): self.make_file("thefile.py", "import sub.another\n") self.make_file("sub/__init__.py", "") self.make_file("sub/another.py", "print('another')\n") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, 'thefile') os.remove("sub/another.py") @@ -352,16 +356,39 @@ class HtmlTest(CoverageTest): cov.html_report() def test_extensionless_file_collides_with_extension(self): - # It used to be that "afile" and "afile.py" would both be reported to - # "afile.html". Now they are not. + # It used to be that "program" and "program.py" would both be reported + # to "program.html". Now they are not. # https://bitbucket.org/ned/coveragepy/issue/69 - self.make_file("afile", "import afile\n") - self.make_file("afile.py", "a = 1\n") - self.run_command("coverage run afile") + self.make_file("program", "import program\n") + self.make_file("program.py", "a = 1\n") + self.run_command("coverage run program") self.run_command("coverage html") self.assert_exists("htmlcov/index.html") - self.assert_exists("htmlcov/afile.html") - self.assert_exists("htmlcov/afile_py.html") + self.assert_exists("htmlcov/program.html") + self.assert_exists("htmlcov/program_py.html") + + def test_has_date_stamp_in_files(self): + self.create_initial_files() + self.run_coverage() + + with open("htmlcov/index.html") as f: + self.assert_correct_timestamp(f.read()) + with open("htmlcov/main_file_py.html") as f: + self.assert_correct_timestamp(f.read()) + + def assert_correct_timestamp(self, html): + """Extract the timestamp from `html`, and assert it is recent.""" + timestamp_pat = r"created at (\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2})" + m = re.search(timestamp_pat, html) + self.assertTrue(m, "Didn't find a timestamp!") + timestamp = datetime.datetime(*map(int, m.groups())) + # The timestamp only records the minute, so the delta could be from + # 12:00 to 12:01:59, or two minutes. + self.assert_recent_datetime( + timestamp, + seconds=120, + msg="Timestamp is wrong: {0}".format(timestamp), + ) class HtmlStaticFileTest(CoverageTest): @@ -382,7 +409,7 @@ class HtmlStaticFileTest(CoverageTest): coverage.html.STATIC_PATH.insert(0, "static_here") self.make_file("main.py", "print(17)") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "main") cov.html_report() @@ -403,7 +430,7 @@ class HtmlStaticFileTest(CoverageTest): coverage.html.STATIC_PATH.insert(0, "static_here") self.make_file("main.py", "print(17)") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "main") cov.html_report() @@ -418,7 +445,7 @@ class HtmlStaticFileTest(CoverageTest): coverage.html.STATIC_PATH = ["/xyzzy"] self.make_file("main.py", "print(17)") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "main") msg = "Couldn't find static file u?'.*'" with self.assertRaisesRegex(CoverageException, msg): diff --git a/tests/test_misc.py b/tests/test_misc.py index 152207b5..76194ef6 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1,8 +1,11 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests of miscellaneous stuff.""" import sys -from coverage.misc import Hasher, file_be_gone, overrides +from coverage.misc import Hasher, file_be_gone from coverage import __version__, __url__ from tests.coveragetest import CoverageTest @@ -87,52 +90,3 @@ class SetupPyTest(CoverageTest): self.assertGreater(len(long_description), 7) self.assertNotEqual(long_description[0].strip(), "") self.assertNotEqual(long_description[-1].strip(), "") - - -class OverridesTest(CoverageTest): - """Test plugins.py:overrides.""" - - run_in_temp_dir = False - - def test_overrides(self): - # pylint: disable=missing-docstring - class SomeBase(object): - def method1(self): - pass - - def method2(self): - pass - - class Derived1(SomeBase): - def method1(self): - pass - - self.assertTrue(overrides(Derived1(), "method1", SomeBase)) - self.assertFalse(overrides(Derived1(), "method2", SomeBase)) - - class FurtherDerived1(Derived1): - """Derive again from Derived1, inherit its method1.""" - pass - - self.assertTrue(overrides(FurtherDerived1(), "method1", SomeBase)) - self.assertFalse(overrides(FurtherDerived1(), "method2", SomeBase)) - - class FurtherDerived2(Derived1): - """Override the overridden method.""" - def method1(self): - pass - - self.assertTrue(overrides(FurtherDerived2(), "method1", SomeBase)) - self.assertFalse(overrides(FurtherDerived2(), "method2", SomeBase)) - - class Mixin(object): - """A mixin that overrides method1.""" - def method1(self): - pass - - class Derived2(Mixin, SomeBase): - """A class that gets the method from the mixin.""" - pass - - self.assertTrue(overrides(Derived2(), "method1", SomeBase)) - self.assertFalse(overrides(Derived2(), "method2", SomeBase)) diff --git a/tests/test_oddball.py b/tests/test_oddball.py index 9fdc654d..05c724b6 100644 --- a/tests/test_oddball.py +++ b/tests/test_oddball.py @@ -1,9 +1,12 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Oddball cases for testing coverage.py""" -import os import sys import coverage +from coverage.files import abs_file from tests.coveragetest import CoverageTest from tests import osinfo @@ -107,7 +110,7 @@ class RecursionTest(CoverageTest): i = 11 """) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "recur") pytrace = (cov.collector.tracer_name() == "PyTracer") @@ -209,7 +212,7 @@ class PyexpatTest(CoverageTest): self.make_file("outer.py", "\n"*100 + "import trydom\na = 102\n") - cov = coverage.coverage() + cov = coverage.Coverage() cov.erase() # Import the Python file, executing it. @@ -307,9 +310,10 @@ class ExceptionTest(CoverageTest): for callnames, lines_expected in runs: # Make the list of functions we'll call for this test. - calls = [getattr(sys.modules[cn], cn) for cn in callnames.split()] + callnames = callnames.split() + calls = [getattr(sys.modules[cn], cn) for cn in callnames] - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() # Call our list of functions: invoke the first, with the rest as # an argument. @@ -318,16 +322,13 @@ class ExceptionTest(CoverageTest): # Clean the line data and compare to expected results. # The filenames are absolute, so keep just the base. - cov._harvest_data() # private! sshhh... - lines = cov.data.line_data() clean_lines = {} - for f, llist in lines.items(): - # f is a path to a Python module, so we drop the '.py' to get - # a callname. - basename = os.path.basename(f) - assert basename.endswith(".py") - if basename[:-3] in callnames: - clean_lines[basename] = llist + data = cov.get_data() + for callname in callnames: + filename = callname + ".py" + lines = data.lines(abs_file(filename)) + clean_lines[filename] = sorted(lines) + self.assertEqual(clean_lines, lines_expected) @@ -400,3 +401,35 @@ class GettraceTest(CoverageTest): f = 12 ''', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "") + + +class ExecTest(CoverageTest): + """Tests of exec.""" + def test_correct_filename(self): + # https://bitbucket.org/ned/coveragepy/issues/380/code-executed-by-exec-excluded-from + # Bug was that exec'd files would have their lines attributed to the + # calling file. Make two files, both with ~30 lines, but no lines in + # common. Line 30 in to_exec.py was recorded as line 30 in main.py, + # but now it's fixed. :) + self.make_file("to_exec.py", """\ + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + print("var is {0}".format(var)) # line 31 + """) + self.make_file("main.py", """\ + namespace = {'var': 17} + with open("to_exec.py") as to_exec_py: + code = compile(to_exec_py.read(), 'to_exec.py', 'exec') + exec(code, globals(), namespace) + \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n + print("done") # line 35 + """) + + cov = coverage.Coverage() + self.start_import_stop(cov, "main") + + _, statements, missing, _ = cov.analysis("main.py") + self.assertEqual(statements, [1, 2, 3, 4, 35]) + self.assertEqual(missing, []) + _, statements, missing, _ = cov.analysis("to_exec.py") + self.assertEqual(statements, [31]) + self.assertEqual(missing, []) diff --git a/tests/test_parser.py b/tests/test_parser.py index 244d4c70..18621d15 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -1,17 +1,25 @@ -"""Tests for Coverage.py's code parsing.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py's code parsing.""" import textwrap + from tests.coveragetest import CoverageTest + +from coverage import env from coverage.parser import PythonParser class PythonParserTest(CoverageTest): - """Tests for Coverage.py's Python code parsing.""" + """Tests for coverage.py's Python code parsing.""" run_in_temp_dir = False def parse_source(self, text): """Parse `text` as source, and return the `PythonParser` used.""" + if env.PY2: + text = text.decode("ascii") text = textwrap.dedent(text) parser = PythonParser(text=text, exclude="nocover") parser.parse_source() @@ -34,6 +42,22 @@ class PythonParserTest(CoverageTest): 2:1, 3:1, 4:2, 5:1, 7:1, 9:1, 10:1 }) + def test_generator_exit_counts(self): + # https://bitbucket.org/ned/coveragepy/issue/324/yield-in-loop-confuses-branch-coverage + parser = self.parse_source("""\ + def gen(input): + for n in inp: + yield (i * 2 for i in range(n)) + + list(gen([1,2,3])) + """) + self.assertEqual(parser.exit_counts(), { + 1:1, # def -> list + 2:2, # for -> yield; for -> exit + 3:2, # yield -> for; genexp exit + 5:1, # list -> exit + }) + def test_try_except(self): parser = self.parse_source("""\ try: @@ -94,10 +118,11 @@ class PythonParserTest(CoverageTest): class ParserFileTest(CoverageTest): - """Tests for Coverage.py's code parsing from files.""" + """Tests for coverage.py's code parsing from files.""" def parse_file(self, filename): """Parse `text` as source, and return the `PythonParser` used.""" + # pylint: disable=attribute-defined-outside-init parser = PythonParser(filename=filename, exclude="nocover") self.statements, self.excluded = parser.parse_source() return parser @@ -121,7 +146,11 @@ class ParserFileTest(CoverageTest): fname = fname + ".py" self.make_file(fname, text, newline=newline) parser = self.parse_file(fname) - self.assertEqual(parser.exit_counts(), counts) + self.assertEqual( + parser.exit_counts(), + counts, + "Wrong for %r" % fname + ) def test_encoding(self): self.make_file("encoded.py", """\ diff --git a/tests/test_phystokens.py b/tests/test_phystokens.py index 7edd6aa4..b4a106fd 100644 --- a/tests/test_phystokens.py +++ b/tests/test_phystokens.py @@ -1,21 +1,26 @@ -"""Tests for Coverage.py's improved tokenizer.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py's improved tokenizer.""" import os.path import re from coverage import env from coverage.phystokens import source_token_lines, source_encoding +from coverage.phystokens import neuter_encoding_declaration +from coverage.python import get_python_source from tests.coveragetest import CoverageTest -SIMPLE = """\ +SIMPLE = u"""\ # yay! def foo(): say('two = %d' % 2) """ -MIXED_WS = """\ +MIXED_WS = u"""\ def hello(): a="Hello world!" \tb="indented" @@ -25,7 +30,7 @@ HERE = os.path.dirname(__file__) class PhysTokensTest(CoverageTest): - """Tests for Coverage.py's improved tokenizer.""" + """Tests for coverage.py's improved tokenizer.""" run_in_temp_dir = False @@ -44,9 +49,7 @@ class PhysTokensTest(CoverageTest): def check_file_tokenization(self, fname): """Use the contents of `fname` for `check_tokenization`.""" - with open(fname) as f: - source = f.read() - self.check_tokenization(source) + self.check_tokenization(get_python_source(fname)) def test_simple(self): self.assertEqual(list(source_token_lines(SIMPLE)), @@ -92,21 +95,27 @@ else: DEF_ENCODING = "ascii" +ENCODING_DECLARATION_SOURCES = [ + # Various forms from http://www.python.org/dev/peps/pep-0263/ + b"# coding=cp850\n\n", + b"#!/usr/bin/python\n# -*- coding: cp850 -*-\n", + b"#!/usr/bin/python\n# vim: set fileencoding=cp850:\n", + b"# This Python file uses this encoding: cp850\n", + b"# This file uses a different encoding:\n# coding: cp850\n", +] + class SourceEncodingTest(CoverageTest): """Tests of source_encoding() for detecting encodings.""" run_in_temp_dir = False def test_detect_source_encoding(self): - # Various forms from http://www.python.org/dev/peps/pep-0263/ - source = b"# coding=cp850\n\n" - self.assertEqual(source_encoding(source), 'cp850') - source = b"#!/usr/bin/python\n# -*- coding: utf-8 -*-\n" - self.assertEqual(source_encoding(source), 'utf-8') - source = b"#!/usr/bin/python\n# vim: set fileencoding=utf8 :\n" - self.assertEqual(source_encoding(source), 'utf8') - source = b"# This Python file uses this encoding: utf-8\n" - self.assertEqual(source_encoding(source), 'utf-8') + for source in ENCODING_DECLARATION_SOURCES: + self.assertEqual( + source_encoding(source), + 'cp850', + "Wrong encoding in %r" % source + ) def test_detect_source_encoding_not_in_comment(self): if env.PYPY and env.PY3: @@ -140,3 +149,19 @@ class SourceEncodingTest(CoverageTest): source = b"\xEF\xBB\xBF# coding: cp850\n" with self.assertRaises(SyntaxError): source_encoding(source) + + +class NeuterEncodingDeclarationTest(CoverageTest): + """Tests of phystokens.neuter_encoding_declaration().""" + + run_in_temp_dir = False + + def test_neuter_encoding_declaration(self): + for source in ENCODING_DECLARATION_SOURCES: + neutered = neuter_encoding_declaration(source.decode("ascii")) + neutered = neutered.encode("ascii") + self.assertEqual( + source_encoding(neutered), + DEF_ENCODING, + "Wrong encoding in %r" % neutered + ) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 69e7b42b..558c0436 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for plugins.""" import os.path @@ -40,6 +43,9 @@ class LoadPluginsTest(CoverageTest): class Plugin(CoveragePlugin): pass + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) config = FakeConfig("plugin1", {}) @@ -55,8 +61,11 @@ class LoadPluginsTest(CoverageTest): class Plugin(CoveragePlugin): def __init__(self, options): - super(Plugin, self).__init__(options) + self.options = options self.this_is = "me" + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin(options)) """) config = FakeConfig("plugin1", {'a': 'hello'}) @@ -73,14 +82,21 @@ class LoadPluginsTest(CoverageTest): class Plugin(CoveragePlugin): def __init__(self, options): - super(Plugin, self).__init__(options) + self.options = options self.this_is = "me" + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin(options)) """) self.make_file("plugin2.py", """\ from coverage import CoveragePlugin class Plugin(CoveragePlugin): - pass + def __init__(self, options): + self.options = options + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin(options)) """) config = FakeConfig("plugin1", {'a': 'hello'}) @@ -105,12 +121,12 @@ class LoadPluginsTest(CoverageTest): with self.assertRaises(ImportError): _ = Plugins.load_plugins(["plugin_not_there"], None) - def test_plugin_must_define_plugin_class(self): + def test_plugin_must_define_coverage_init(self): self.make_file("no_plugin.py", """\ from coverage import CoveragePlugin Nothing = 0 """) - msg_pat = "Plugin module 'no_plugin' didn't define a Plugin class" + msg_pat = "Plugin module 'no_plugin' didn't define a coverage_init function" with self.assertRaisesRegex(CoverageException, msg_pat): list(Plugins.load_plugins(["no_plugin"], None)) @@ -124,6 +140,8 @@ class PluginTest(CoverageTest): from coverage import CoveragePlugin class Plugin(CoveragePlugin): pass + def coverage_init(reg, options): + reg.add_noop(Plugin()) with open("evidence.out", "w") as f: f.write("we are here!") """) @@ -163,6 +181,9 @@ class PluginTest(CoverageTest): class Plugin(coverage.CoveragePlugin): def sys_info(self): return [("hello", "world")] + + def coverage_init(reg, options): + reg.add_noop(Plugin()) """) debug_out = StringIO() cov = coverage.Coverage(debug=["sys"]) @@ -172,7 +193,7 @@ class PluginTest(CoverageTest): out_lines = debug_out.getvalue().splitlines() expected_end = [ - "-- sys: plugin_sys_info --------------------------------------", + "-- sys: plugin_sys_info.Plugin -------------------------------", " hello: world", "-- end -------------------------------------------------------", ] @@ -184,6 +205,9 @@ class PluginTest(CoverageTest): class Plugin(coverage.CoveragePlugin): pass + + def coverage_init(reg, options): + reg.add_noop(Plugin()) """) debug_out = StringIO() cov = coverage.Coverage(debug=["sys"]) @@ -193,7 +217,7 @@ class PluginTest(CoverageTest): out_lines = debug_out.getvalue().splitlines() expected_end = [ - "-- sys: plugin_no_sys_info -----------------------------------", + "-- sys: plugin_no_sys_info.Plugin ----------------------------", "-- end -------------------------------------------------------", ] self.assertEqual(expected_end, out_lines[-len(expected_end):]) @@ -202,8 +226,10 @@ class PluginTest(CoverageTest): self.make_file("importing_plugin.py", """\ from coverage import CoveragePlugin import local_module - class Plugin(CoveragePlugin): + class MyPlugin(CoveragePlugin): pass + def coverage_init(reg, options): + reg.add_noop(MyPlugin()) """) self.make_file("local_module.py", "CONST = 1") self.make_file(".coveragerc", """\ @@ -220,12 +246,10 @@ class PluginTest(CoverageTest): class PluginWarningOnPyTracer(CoverageTest): """Test that we get a controlled exception with plugins on PyTracer.""" - def setUp(self): - super(PluginWarningOnPyTracer, self).setUp() + def test_exception_if_plugins_on_pytracer(self): if env.C_TRACER: self.skip("This test is only about PyTracer.") - def test_exception_if_plugins_on_pytracer(self): self.make_file("simple.py", """a = 1""") cov = coverage.Coverage() @@ -233,13 +257,13 @@ class PluginWarningOnPyTracer(CoverageTest): warnings = [] def capture_warning(msg): + """A fake implementation of Coverage._warn, to capture warnings.""" warnings.append(msg) cov._warn = capture_warning self.start_import_stop(cov, "simple") self.assertIn( - "Plugin file tracers (tests.plugin1) " - "aren't supported with PyTracer", + "Plugin file tracers (tests.plugin1.Plugin) aren't supported with PyTracer", warnings ) @@ -283,6 +307,7 @@ class GoodPluginTest(FileTracerTest): self.assertEqual(statements, [105, 106, 107, 205, 206, 207]) def make_render_and_caller(self): + """Make the render.py and caller.py files we need.""" # plugin2 emulates a dynamic tracing plugin: the caller's locals # are examined to determine the source file and line number. # The plugin is in tests/plugin2.py. @@ -344,20 +369,20 @@ class GoodPluginTest(FileTracerTest): _, statements, missing, _ = cov.analysis("foo_7.html") self.assertEqual(statements, [1, 2, 3, 4, 5, 6, 7]) self.assertEqual(missing, [1, 2, 3, 6, 7]) - self.assertIn("foo_7.html", cov.data.summary()) + self.assertIn("foo_7.html", cov.data.line_counts()) _, statements, missing, _ = cov.analysis("bar_4.html") self.assertEqual(statements, [1, 2, 3, 4]) self.assertEqual(missing, [1, 4]) - self.assertIn("bar_4.html", cov.data.summary()) + self.assertIn("bar_4.html", cov.data.line_counts()) - self.assertNotIn("quux_5.html", cov.data.summary()) + self.assertNotIn("quux_5.html", cov.data.line_counts()) if env.PY2: _, statements, missing, _ = cov.analysis("uni_3.html") self.assertEqual(statements, [1, 2, 3]) self.assertEqual(missing, [1]) - self.assertIn("uni_3.html", cov.data.summary()) + self.assertIn("uni_3.html", cov.data.line_counts()) def test_plugin2_with_branch(self): self.make_render_and_caller() @@ -437,11 +462,62 @@ class GoodPluginTest(FileTracerTest): ]: self.assertIn(snip, xml) + def test_defer_to_python(self): + # A plugin that measures, but then wants built-in python reporting. + self.make_file("fairly_odd_plugin.py", """\ + # A plugin that claims all the odd lines are executed, and none of + # the even lines, and then punts reporting off to the built-in + # Python reporting. + import coverage.plugin + class Plugin(coverage.CoveragePlugin): + def file_tracer(self, filename): + return OddTracer(filename) + def file_reporter(self, filename): + return "python" + + class OddTracer(coverage.plugin.FileTracer): + def __init__(self, filename): + self.filename = filename + def source_filename(self): + return self.filename + def line_number_range(self, frame): + lineno = frame.f_lineno + if lineno % 2: + return (lineno, lineno) + else: + return (-1, -1) + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) + """) + self.make_file("unsuspecting.py", """\ + a = 1 + b = 2 + c = 3 + d = 4 + e = 5 + f = 6 + """) + cov = coverage.Coverage(include=["unsuspecting.py"]) + cov.config["run:plugins"] = ["fairly_odd_plugin"] + self.start_import_stop(cov, "unsuspecting") + + repout = StringIO() + total = cov.report(file=repout) + report = repout.getvalue().splitlines() + expected = [ + 'Name Stmts Miss Cover Missing', + '-----------------------------------------------', + 'unsuspecting.py 6 3 50% 2, 4, 6', + ] + self.assertEqual(report, expected) + self.assertEqual(total, 50) + class BadPluginTest(FileTracerTest): """Test error handling around plugins.""" - def run_bad_plugin(self, plugin_name, our_error=True): + def run_bad_plugin(self, module_name, plugin_name, our_error=True): """Run a file, and see that the plugin failed. `plugin_name` is the name of the plugin to use. @@ -449,6 +525,9 @@ class BadPluginTest(FileTracerTest): `our_error` is True if the error reported to the user will be an explicit error in our test code, marked with an # Oh noes! comment. + The plugin will be disabled, and we check that a warning is output + explaining why. + """ self.make_file("simple.py", """\ import other, another @@ -469,7 +548,7 @@ class BadPluginTest(FileTracerTest): """) cov = coverage.Coverage() - cov.config["run:plugins"] = [plugin_name] + cov.config["run:plugins"] = [module_name] self.start_import_stop(cov, "simple") stderr = self.stderr() @@ -481,18 +560,35 @@ class BadPluginTest(FileTracerTest): self.assertEqual(errors, 1) # There should be a warning explaining what's happening, but only one. - msg = "Disabling plugin %r due to an exception:" % plugin_name + # The message can be in two forms: + # Disabling plugin '...' due to previous exception + # or: + # Disabling plugin '...' due to an exception: + msg = "Disabling plugin '%s.%s' due to " % (module_name, plugin_name) warnings = stderr.count(msg) self.assertEqual(warnings, 1) + def test_file_tracer_has_no_file_tracer_method(self): + self.make_file("bad_plugin.py", """\ + class Plugin(object): + pass + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) + """) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) + def test_file_tracer_fails(self): self.make_file("bad_plugin.py", """\ import coverage.plugin class Plugin(coverage.plugin.CoveragePlugin): def file_tracer(self, filename): 17/0 # Oh noes! + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin") + self.run_bad_plugin("bad_plugin", "Plugin") def test_file_tracer_returns_wrong(self): self.make_file("bad_plugin.py", """\ @@ -500,8 +596,11 @@ class BadPluginTest(FileTracerTest): class Plugin(coverage.plugin.CoveragePlugin): def file_tracer(self, filename): return 3.14159 + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin", our_error=False) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) def test_has_dynamic_source_filename_fails(self): self.make_file("bad_plugin.py", """\ @@ -513,8 +612,11 @@ class BadPluginTest(FileTracerTest): class BadFileTracer(coverage.plugin.FileTracer): def has_dynamic_source_filename(self): 23/0 # Oh noes! + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin") + self.run_bad_plugin("bad_plugin", "Plugin") def test_source_filename_fails(self): self.make_file("bad_plugin.py", """\ @@ -526,8 +628,11 @@ class BadPluginTest(FileTracerTest): class BadFileTracer(coverage.plugin.FileTracer): def source_filename(self): 42/0 # Oh noes! + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin") + self.run_bad_plugin("bad_plugin", "Plugin") def test_source_filename_returns_wrong(self): self.make_file("bad_plugin.py", """\ @@ -539,8 +644,11 @@ class BadPluginTest(FileTracerTest): class BadFileTracer(coverage.plugin.FileTracer): def source_filename(self): return 17.3 + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin", our_error=False) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) def test_dynamic_source_filename_fails(self): self.make_file("bad_plugin.py", """\ @@ -555,8 +663,11 @@ class BadPluginTest(FileTracerTest): return True def dynamic_source_filename(self, filename, frame): 101/0 # Oh noes! + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin") + self.run_bad_plugin("bad_plugin", "Plugin") def test_line_number_range_returns_non_tuple(self): self.make_file("bad_plugin.py", """\ @@ -572,8 +683,11 @@ class BadPluginTest(FileTracerTest): def line_number_range(self, frame): return 42.23 + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin", our_error=False) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) def test_line_number_range_returns_triple(self): self.make_file("bad_plugin.py", """\ @@ -589,8 +703,11 @@ class BadPluginTest(FileTracerTest): def line_number_range(self, frame): return (1, 2, 3) + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin", our_error=False) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) def test_line_number_range_returns_pair_of_strings(self): self.make_file("bad_plugin.py", """\ @@ -606,5 +723,8 @@ class BadPluginTest(FileTracerTest): def line_number_range(self, frame): return ("5", "7") + + def coverage_init(reg, options): + reg.add_file_tracer(Plugin()) """) - self.run_bad_plugin("bad_plugin", our_error=False) + self.run_bad_plugin("bad_plugin", "Plugin", our_error=False) diff --git a/tests/test_process.py b/tests/test_process.py index 1ae8e922..7c8b0c2d 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1,3 +1,7 @@ +# coding: utf8 +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for process behavior of coverage.py.""" import glob @@ -7,7 +11,7 @@ import sys import textwrap import coverage -from coverage import env +from coverage import env, CoverageData from tests.coveragetest import CoverageTest @@ -49,7 +53,8 @@ class ProcessTest(CoverageTest): self.assert_exists(".coverage") self.assertEqual(out, 'done\n') - def test_combine_parallel_data(self): + def make_b_or_c_py(self): + """Create b_or_c.py, used in a few of these tests.""" self.make_file("b_or_c.py", """\ import sys a = 1 @@ -61,9 +66,12 @@ class ProcessTest(CoverageTest): print('done') """) + def test_combine_parallel_data(self): + self.make_b_or_c_py() out = self.run_command("coverage run -p b_or_c.py b") self.assertEqual(out, 'done\n') self.assert_doesnt_exist(".coverage") + self.assertEqual(self.number_of_data_files(), 1) out = self.run_command("coverage run -p b_or_c.py c") self.assertEqual(out, 'done\n') @@ -83,19 +91,10 @@ class ProcessTest(CoverageTest): # executed. data = coverage.CoverageData() data.read_file(".coverage") - self.assertEqual(data.summary()['b_or_c.py'], 7) + self.assertEqual(data.line_counts()['b_or_c.py'], 7) def test_combine_parallel_data_in_two_steps(self): - self.make_file("b_or_c.py", """\ - import sys - a = 1 - if sys.argv[1] == 'b': - b = 1 - else: - c = 1 - d = 1 - print('done') - """) + self.make_b_or_c_py() out = self.run_command("coverage run -p b_or_c.py b") self.assertEqual(out, 'done\n') @@ -107,7 +106,7 @@ class ProcessTest(CoverageTest): self.assert_exists(".coverage") self.assertEqual(self.number_of_data_files(), 1) - out = self.run_command("coverage run --append -p b_or_c.py c") + out = self.run_command("coverage run -p b_or_c.py c") self.assertEqual(out, 'done\n') self.assert_exists(".coverage") self.assertEqual(self.number_of_data_files(), 2) @@ -123,20 +122,54 @@ class ProcessTest(CoverageTest): # executed. data = coverage.CoverageData() data.read_file(".coverage") - self.assertEqual(data.summary()['b_or_c.py'], 7) + self.assertEqual(data.line_counts()['b_or_c.py'], 7) - def test_combine_with_rc(self): - self.make_file("b_or_c.py", """\ - import sys - a = 1 - if sys.argv[1] == 'b': - b = 1 - else: - c = 1 - d = 1 - print('done') + def test_append_data(self): + self.make_b_or_c_py() + + out = self.run_command("coverage run b_or_c.py b") + self.assertEqual(out, 'done\n') + self.assert_exists(".coverage") + self.assertEqual(self.number_of_data_files(), 1) + + out = self.run_command("coverage run --append b_or_c.py c") + self.assertEqual(out, 'done\n') + self.assert_exists(".coverage") + self.assertEqual(self.number_of_data_files(), 1) + + # Read the coverage file and see that b_or_c.py has all 7 lines + # executed. + data = coverage.CoverageData() + data.read_file(".coverage") + self.assertEqual(data.line_counts()['b_or_c.py'], 7) + + def test_append_data_with_different_file(self): + self.make_b_or_c_py() + + self.make_file(".coveragerc", """\ + [run] + data_file = .mycovdata """) + out = self.run_command("coverage run b_or_c.py b") + self.assertEqual(out, 'done\n') + self.assert_doesnt_exist(".coverage") + self.assert_exists(".mycovdata") + + out = self.run_command("coverage run --append b_or_c.py c") + self.assertEqual(out, 'done\n') + self.assert_doesnt_exist(".coverage") + self.assert_exists(".mycovdata") + + # Read the coverage file and see that b_or_c.py has all 7 lines + # executed. + data = coverage.CoverageData() + data.read_file(".mycovdata") + self.assertEqual(data.line_counts()['b_or_c.py'], 7) + + def test_combine_with_rc(self): + self.make_b_or_c_py() + self.make_file(".coveragerc", """\ [run] parallel = true @@ -165,7 +198,7 @@ class ProcessTest(CoverageTest): # executed. data = coverage.CoverageData() data.read_file(".coverage") - self.assertEqual(data.summary()['b_or_c.py'], 7) + self.assertEqual(data.line_counts()['b_or_c.py'], 7) # Reporting should still work even with the .rc file out = self.run_command("coverage report") @@ -219,13 +252,30 @@ class ProcessTest(CoverageTest): # files have been combined together. data = coverage.CoverageData() data.read_file(".coverage") - summary = data.summary(fullpath=True) + summary = data.line_counts(fullpath=True) self.assertEqual(len(summary), 1) actual = os.path.normcase(os.path.abspath(list(summary.keys())[0])) expected = os.path.normcase(os.path.abspath('src/x.py')) self.assertEqual(actual, expected) self.assertEqual(list(summary.values())[0], 6) + def test_erase_parallel(self): + self.make_file(".coveragerc", """\ + [run] + data_file = data.dat + parallel = True + """) + self.make_file("data.dat") + self.make_file("data.dat.fooey") + self.make_file("data.dat.gooey") + self.make_file(".coverage") + + self.run_command("coverage erase") + self.assert_doesnt_exist("data.dat") + self.assert_doesnt_exist("data.dat.fooey") + self.assert_doesnt_exist("data.dat.gooey") + self.assert_exists(".coverage") + def test_missing_source_file(self): # Check what happens if the source is missing when reporting happens. self.make_file("fleeting.py", """\ @@ -397,7 +447,7 @@ class ProcessTest(CoverageTest): def test_coverage_run_dashm_is_like_python_dashm_with__main__207(self): if sys.version_info < (2, 7): - # Coverage isn't bug-for-bug compatible in the behavior of -m for + # Coverage.py isn't bug-for-bug compatible in the behavior of -m for # Pythons < 2.7 self.skip("-m doesn't work the same < Python 2.7") # https://bitbucket.org/ned/coveragepy/issue/207 @@ -447,7 +497,7 @@ class ProcessTest(CoverageTest): # executed. data = coverage.CoverageData() data.read_file(".coverage") - self.assertEqual(data.summary()['fork.py'], 9) + self.assertEqual(data.line_counts()['fork.py'], 9) def test_warnings(self): self.make_file("hello.py", """\ @@ -531,6 +581,21 @@ class ProcessTest(CoverageTest): self.assertIn("Trace function changed", out) + def test_note(self): + self.make_file(".coveragerc", """\ + [run] + data_file = mydata.dat + note = These are musical notes: ♫𝅗𝅥♩ + """) + self.make_file("simple.py", """print('hello')""") + self.run_command("coverage run simple.py") + + data = CoverageData() + data.read_file("mydata.dat") + infos = data.run_infos() + self.assertEqual(len(infos), 1) + self.assertEqual(infos[0]['note'], u"These are musical notes: ♫𝅗𝅥♩") + def test_fullcoverage(self): # pragma: not covered if env.PY2: # This doesn't work on Python 2. self.skip("fullcoverage doesn't work on Python 2.") @@ -558,7 +623,7 @@ class ProcessTest(CoverageTest): # The actual number of executed lines in os.py when it's # imported is 120 or so. Just running os.getenv executes # about 5. - self.assertGreater(data.summary()['os.py'], 50) + self.assertGreater(data.line_counts()['os.py'], 50) def test_deprecation_warnings(self): # Test that coverage doesn't trigger deprecation warnings. @@ -593,8 +658,7 @@ class ProcessTest(CoverageTest): out = self.run_command("python run_twice.py") self.assertEqual( out, - "Coverage.py warning: " - "Module foo was previously imported, but not measured.\n" + "Coverage.py warning: Module foo was previously imported, but not measured.\n" ) @@ -704,6 +768,51 @@ class FailUnderTest(CoverageTest): self.assertEqual(st, 2) +class FailUnderNoFilesTest(CoverageTest): + """Test that nothing to report results in an error exit status.""" + def setUp(self): + super(FailUnderNoFilesTest, self).setUp() + self.make_file(".coveragerc", "[report]\nfail_under = 99\n") + + def test_report(self): + st, out = self.run_command_status("coverage report") + self.assertIn('No data to report.', out) + self.assertEqual(st, 1) + + def test_xml(self): + st, out = self.run_command_status("coverage xml") + self.assertIn('No data to report.', out) + self.assertEqual(st, 1) + + def test_html(self): + st, out = self.run_command_status("coverage html") + self.assertIn('No data to report.', out) + self.assertEqual(st, 1) + + +class FailUnderEmptyFilesTest(CoverageTest): + """Test that empty files produce the proper fail_under exit status.""" + def setUp(self): + super(FailUnderEmptyFilesTest, self).setUp() + + self.make_file(".coveragerc", "[report]\nfail_under = 99\n") + self.make_file("empty.py", "") + st, _ = self.run_command_status("coverage run empty.py") + self.assertEqual(st, 0) + + def test_report(self): + st, _ = self.run_command_status("coverage report") + self.assertEqual(st, 2) + + def test_xml(self): + st, _ = self.run_command_status("coverage xml") + self.assertEqual(st, 2) + + def test_html(self): + st, _ = self.run_command_status("coverage html") + self.assertEqual(st, 2) + + def possible_pth_dirs(): """Produce a sequence of directories for trying to write .pth files.""" # First look through sys.path, and we find a .pth file, then it's a good @@ -715,12 +824,12 @@ def possible_pth_dirs(): # If we're still looking, then try the Python library directory. # https://bitbucket.org/ned/coveragepy/issue/339/pth-test-malfunctions - import distutils.sysconfig + import distutils.sysconfig # pylint: disable=import-error yield distutils.sysconfig.get_python_lib() class ProcessCoverageMixin(object): - """Set up a .pth file that causes all sub-processes to be coverage'd""" + """Set up a .pth file to coverage-measure all sub-processes.""" def setUp(self): super(ProcessCoverageMixin, self).setUp() @@ -775,7 +884,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest): self.assert_exists(".mycovdata") data = coverage.CoverageData() data.read_file(".mycovdata") - self.assertEqual(data.summary()['sub.py'], 2) + self.assertEqual(data.line_counts()['sub.py'], 2) class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): @@ -795,18 +904,34 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): def assert_pth_and_source_work_together( self, dashm, package, source ): # pragma: not covered + """Run the test for a particular combination of factors. + + The arguments are all strings: + + * `dashm`: Either "" (run the program as a file) or "-m" (run the + program as a module). + + * `package`: Either "" (put the source at the top level) or a + package name to use to hold the source. + + * `source`: Either "main" or "sub", which file to use as the + ``--source`` argument. + + """ if env.METACOV: self.skip( "Can't test sub-process pth file suppport during metacoverage" ) def fullname(modname): + """What is the full module name for `modname` for this test?""" if package and dashm: return '.'.join((package, modname)) else: return modname def path(basename): + """Where should `basename` be created for this test?""" return os.path.join(package, basename) # Main will run sub.py. @@ -829,13 +954,11 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): self.set_environ("COVERAGE_PROCESS_START", "coverage.ini") if dashm: - cmd = (sys.executable, dashm, fullname('main')) + cmd = "python -m %s" % fullname('main') else: - cmd = (sys.executable, path('main.py')) + cmd = "python %s" % path('main.py') - # TODO: can we use run_command here instead of Popen? - from subprocess import Popen - Popen(cmd).wait() + self.run_command(cmd) with open("out.txt") as f: self.assertEqual(f.read(), "Hello, world!") @@ -844,7 +967,7 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): self.assert_exists(".coverage") data = coverage.CoverageData() data.read_file(".coverage") - summary = data.summary() + summary = data.line_counts() print(summary) self.assertEqual(summary[source + '.py'], 2) self.assertEqual(len(summary), 1) diff --git a/tests/test_python.py b/tests/test_python.py index f2c18a10..e510e786 100644 --- a/tests/test_python.py +++ b/tests/test_python.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests of coverage/python.py""" import os diff --git a/tests/test_results.py b/tests/test_results.py index 4ce048b6..54c2f6d7 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -1,11 +1,14 @@ -"""Tests for Coverage.py's results analysis.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + +"""Tests for coverage.py's results analysis.""" from coverage.results import Numbers from tests.coveragetest import CoverageTest class NumbersTest(CoverageTest): - """Tests for Coverage.py's numeric measurement summaries.""" + """Tests for coverage.py's numeric measurement summaries.""" run_in_temp_dir = False diff --git a/tests/test_summary.py b/tests/test_summary.py index c7327f1f..850f4dfd 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Test text-based summary reporting for coverage.py""" import glob @@ -21,16 +24,20 @@ class SummaryTest(CoverageTest): def setUp(self): super(SummaryTest, self).setUp() + # Parent class saves and restores sys.path, we can just modify it. + sys.path.append(self.nice_file(HERE, 'modules')) + + def make_mycode(self): + """Make the mycode.py file when needed.""" self.make_file("mycode.py", """\ import covmod1 import covmodzip1 a = 1 print('done') """) - # Parent class saves and restores sys.path, we can just modify it. - sys.path.append(self.nice_file(HERE, 'modules')) def test_report(self): + self.make_mycode() out = self.run_command("coverage run mycode.py") self.assertEqual(out, 'done\n') report = self.report_from_command("coverage report") @@ -38,19 +45,20 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ------------------------------------------------------------------ # c:/ned/coverage/tests/modules/covmod1.py 2 0 100% - # c:/ned/coverage/tests/zipmods.zip/covmodzip1.py 2 0 100% + # c:/ned/coverage/tests/zipmods.zip/covmodzip1.py 3 0 100% # mycode.py 4 0 100% # ------------------------------------------------------------------ - # TOTAL 8 0 100% + # TOTAL 9 0 100% self.assertNotIn("/coverage/__init__/", report) self.assertIn("/tests/modules/covmod1.py ", report) self.assertIn("/tests/zipmods.zip/covmodzip1.py ", report) self.assertIn("mycode.py ", report) - self.assertEqual(self.last_line_squeezed(report), "TOTAL 8 0 100%") + self.assertEqual(self.last_line_squeezed(report), "TOTAL 9 0 100%") def test_report_just_one(self): # Try reporting just one module + self.make_mycode() self.run_command("coverage run mycode.py") report = self.report_from_command("coverage report mycode.py") @@ -67,6 +75,7 @@ class SummaryTest(CoverageTest): def test_report_wildcard(self): # Try reporting using wildcards to get the modules. + self.make_mycode() self.run_command("coverage run mycode.py") report = self.report_from_command("coverage report my*.py") @@ -83,10 +92,9 @@ class SummaryTest(CoverageTest): def test_report_omitting(self): # Try reporting while omitting some modules + self.make_mycode() self.run_command("coverage run mycode.py") - report = self.report_from_command( - "coverage report --omit '%s/*'" % HERE - ) + report = self.report_from_command("coverage report --omit '%s/*'" % HERE) # Name Stmts Miss Cover # ------------------------------- @@ -101,6 +109,7 @@ class SummaryTest(CoverageTest): def test_report_including(self): # Try reporting while including some modules + self.make_mycode() self.run_command("coverage run mycode.py") report = self.report_from_command("coverage report --include=mycode*") @@ -325,6 +334,7 @@ class SummaryTest(CoverageTest): # We run a .py file, and when reporting, we can't parse it as Python. # We should get an error message in the report. + self.make_mycode() self.run_command("coverage run mycode.py") self.make_file("mycode.py", "This isn't python at all!") report = self.report_from_command("coverage report mycode.py") @@ -333,8 +343,9 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- # mycode NotPython: Couldn't parse '/tmp/test_cover/63354509363/mycode.py' as Python source: 'invalid syntax' at line 1 + # No data to report. - last = self.last_line_squeezed(report) + last = self.squeezed_lines(report)[-2] # The actual file name varies run to run. last = re.sub(r"parse '.*mycode.py", "parse 'mycode.py", last) # The actual error message varies version to version @@ -348,6 +359,7 @@ class SummaryTest(CoverageTest): def test_dotpy_not_python_ignored(self): # We run a .py file, and when reporting, we can't parse it as Python, # but we've said to ignore errors, so there's no error reported. + self.make_mycode() self.run_command("coverage run mycode.py") self.make_file("mycode.py", "This isn't python at all!") report = self.report_from_command("coverage report -i mycode.py") @@ -355,7 +367,8 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- - self.assertEqual(self.line_count(report), 2) + self.assertEqual(self.line_count(report), 3) + self.assertIn('No data to report.', report) def test_dothtml_not_python(self): # We run a .html file, and when reporting, we can't parse it as @@ -370,8 +383,10 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Cover # ---------------------------- + # No data to report. - self.assertEqual(self.line_count(report), 2) + self.assertEqual(self.line_count(report), 3) + self.assertIn('No data to report.', report) def get_report(self, cov): """Get the report from `cov`, and canonicalize it.""" @@ -393,7 +408,7 @@ class SummaryTest(CoverageTest): self.make_file("main.py", """\ print("y") """) - cov = coverage.coverage(branch=True, source=["."]) + cov = coverage.Coverage(branch=True, source=["."]) cov.start() import main # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -402,7 +417,7 @@ class SummaryTest(CoverageTest): def run_TheCode_and_report_it(self): """A helper for the next few tests.""" - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import TheCode # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -437,7 +452,7 @@ class SummaryTest(CoverageTest): self.make_file("mod.pyw", """\ print("In mod.pyw") """) - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import start # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -457,7 +472,7 @@ class SummaryTest(CoverageTest): py_compile.compile("mod.py") # Run the program. - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import main # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -487,7 +502,7 @@ class SummaryTest(CoverageTest): os.rename(pycs[0], "mod.pyc") # Run the program. - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import main # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -515,7 +530,7 @@ class SummaryTest2(CoverageTest): def test_empty_files(self): # Shows that empty files like __init__.py are listed as having zero # statements, not one statement. - cov = coverage.coverage() + cov = coverage.Coverage() cov.start() import usepkgs # pragma: nested # pylint: disable=import-error,unused-variable cov.stop() # pragma: nested @@ -544,7 +559,7 @@ class ReportingReturnValueTest(CoverageTest): g = 7 """) - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "doit") return cov diff --git a/tests/test_templite.py b/tests/test_templite.py index 2b64e4e3..2f9b2dbd 100644 --- a/tests/test_templite.py +++ b/tests/test_templite.py @@ -1,4 +1,7 @@ # -*- coding: utf8 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for coverage.templite.""" import re diff --git a/tests/test_testing.py b/tests/test_testing.py index 75db7e50..39c711ba 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -1,6 +1,10 @@ # -*- coding: utf-8 -*- +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests that our test infrastructure is really working!""" +import datetime import os import sys @@ -62,6 +66,14 @@ class TempDirMixinTest(TempDirMixin, TestCase): class CoverageTestTest(CoverageTest): """Test the methods in `CoverageTest`.""" + def test_arcz_to_arcs(self): + self.assertEqual(self.arcz_to_arcs(".1 12 2."), [(-1, 1), (1, 2), (2, -1)]) + self.assertEqual(self.arcz_to_arcs("-11 12 2-5"), [(-1, 1), (1, 2), (2, -5)]) + self.assertEqual( + self.arcz_to_arcs("-QA CB IT Z-A"), + [(-26, 10), (12, 11), (18, 29), (35, -10)] + ) + def test_file_exists(self): self.make_file("whoville.txt", "We are here!") self.assert_exists("whoville.txt") @@ -80,6 +92,27 @@ class CoverageTestTest(CoverageTest): with self.assertRaises(AssertionError): self.assert_starts_with("xyz\nabc", "a") + def test_assert_recent_datetime(self): + def now_delta(seconds): + """Make a datetime `seconds` seconds from now.""" + return datetime.datetime.now() + datetime.timedelta(seconds=seconds) + + # Default delta is 10 seconds. + self.assert_recent_datetime(now_delta(0)) + self.assert_recent_datetime(now_delta(-9)) + with self.assertRaises(AssertionError): + self.assert_recent_datetime(now_delta(-11)) + with self.assertRaises(AssertionError): + self.assert_recent_datetime(now_delta(1)) + + # Delta is settable. + self.assert_recent_datetime(now_delta(0), seconds=120) + self.assert_recent_datetime(now_delta(-100), seconds=120) + with self.assertRaises(AssertionError): + self.assert_recent_datetime(now_delta(-1000), seconds=120) + with self.assertRaises(AssertionError): + self.assert_recent_datetime(now_delta(1), seconds=120) + def test_sub_python_is_this_python(self): # Try it with a Python command. os.environ['COV_FOOBAR'] = 'XYZZY' @@ -97,10 +130,10 @@ class CoverageTestTest(CoverageTest): # Try it with a "coverage debug sys" command. out = self.run_command("coverage debug sys").splitlines() # "environment: COV_FOOBAR = XYZZY" or "COV_FOOBAR = XYZZY" - executable = next(l for l in out if "executable:" in l) + executable = next(l for l in out if "executable:" in l) # pragma: part covered executable = executable.split(":", 1)[1].strip() self.assertTrue(same_python_executable(executable, sys.executable)) - environ = next(l for l in out if "COV_FOOBAR" in l) + environ = next(l for l in out if "COV_FOOBAR" in l) # pragma: part covered _, _, environ = environ.rpartition(":") self.assertEqual(environ.strip(), "COV_FOOBAR = XYZZY") diff --git a/tests/test_xml.py b/tests/test_xml.py index b9b36efb..dbf09279 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Tests for XML reports from coverage.py.""" import os @@ -21,7 +24,7 @@ class XmlTestHelpers(CoverageTest): self.make_file("sub/__init__.py") self.make_file("sub/doit.py", "print('doit!')") self.make_file("main.py", "import sub.doit") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "main") return cov @@ -30,7 +33,7 @@ class XmlTestHelpers(CoverageTest): Makes `width` directories, named d0 .. d{width-1}. Each directory has __init__.py, and `width` files, named f0.py .. f{width-1}.py. Each - directory also has `width` subdirectories, in the same fashion, until + directory also has `width` sub-directories, in the same fashion, until a depth of `depth` is reached. """ @@ -88,7 +91,7 @@ class XmlReportTest(XmlTestHelpers, CoverageTest): # Written while investigating a bug, might as well keep it. # https://bitbucket.org/ned/coveragepy/issue/208 self.make_file("innocuous.py", "a = 4") - cov = coverage.coverage() + cov = coverage.Coverage() self.start_import_stop(cov, "innocuous") os.remove("innocuous.py") cov.xml_report(ignore_errors=True) @@ -120,7 +123,7 @@ class XmlReportTest(XmlTestHelpers, CoverageTest): # Used to raise a zero division error: # https://bitbucket.org/ned/coveragepy/issue/250 self.make_file("empty.py", "") - cov = coverage.coverage() + cov = coverage.Coverage() empty = self.start_import_stop(cov, "empty") cov.xml_report([empty], outfile="-") xml = self.stdout() @@ -160,7 +163,7 @@ class XmlPackageStructureTest(XmlTestHelpers, CoverageTest): self.make_file("main.py", """\ from d0.d0 import f0 """) - cov = coverage.coverage(source=".") + cov = coverage.Coverage(source=".") self.start_import_stop(cov, "main") self.assert_package_and_class_tags(cov, """\ <package name="."> @@ -178,7 +181,7 @@ class XmlPackageStructureTest(XmlTestHelpers, CoverageTest): self.make_file("main.py", """\ from d0.d0 import f0 """) - cov = coverage.coverage(source=".") + cov = coverage.Coverage(source=".") self.start_import_stop(cov, "main") cov.config["xml:package_depth"] = 1 diff --git a/tests/try_execfile.py b/tests/try_execfile.py index e0b79b48..70905071 100644 --- a/tests/try_execfile.py +++ b/tests/try_execfile.py @@ -1,3 +1,6 @@ +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt + """Test file for run_python_file. This file is executed two ways:: |