diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-22 22:04:46 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-22 22:04:46 -0400 |
commit | bdff9572a03fea704c4ef2f3ff021634b7f31c7b (patch) | |
tree | 037dcc57fcc6b941478b1979f8806cbba26a6771 /tests | |
parent | 059b19d26dbc105340ffe4f150a1d2034956c3a3 (diff) | |
download | python-coveragepy-bdff9572a03fea704c4ef2f3ff021634b7f31c7b.tar.gz |
Filtering now computes coverage percentages properly.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/farm/html/gold_omit_1/index.html | 30 | ||||
-rw-r--r-- | tests/farm/html/run_a.py | 3 | ||||
-rw-r--r-- | tests/farm/html/run_b_branch.py | 3 | ||||
-rw-r--r-- | tests/test_farm.py | 3 | ||||
-rw-r--r-- | tests/test_results.py | 10 |
5 files changed, 36 insertions, 13 deletions
diff --git a/tests/farm/html/gold_omit_1/index.html b/tests/farm/html/gold_omit_1/index.html index b7ee359..34fd8fc 100644 --- a/tests/farm/html/gold_omit_1/index.html +++ b/tests/farm/html/gold_omit_1/index.html @@ -4,7 +4,9 @@ <meta http-equiv='Content-Type' content='text/html; charset=utf-8'> <title>Coverage report</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.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> @@ -12,19 +14,25 @@ jQuery(document).ready(coverage.index_ready); </script> </head> -<body id='indexfile'> +<body class='indexfile'> <div id='header'> <div class='content'> <h1>Coverage report: <span class='pc_cov'>100%</span> </h1> - <img id='keyboard_icon' src='keybd_closed.png'> + + <img id='keyboard_icon' src='keybd_closed.png' /> + + <form id="filter_container"> + <label for="filter">Filter</label> + <input id="filter" type="text" value="" /> + </form> </div> </div> <div class='help_panel'> - <img id='panel_icon' src='keybd_open.png'> + <img id='panel_icon' src='keybd_open.png' /> <p class='legend'>Hot-keys on this page</p> <div> <p class='keyhelp'> @@ -59,7 +67,7 @@ <td>0</td> <td>0</td> - <td class='right'>100%</td> + <td class='right' data-ratio='14 14'>100%</td> </tr> </tfoot> <tbody> @@ -70,7 +78,7 @@ <td>0</td> <td>0</td> - <td class='right'>100%</td> + <td class='right' data-ratio='2 2'>100%</td> </tr> <tr class='file'> @@ -79,7 +87,7 @@ <td>0</td> <td>0</td> - <td class='right'>100%</td> + <td class='right' data-ratio='2 2'>100%</td> </tr> <tr class='file'> @@ -88,7 +96,7 @@ <td>0</td> <td>0</td> - <td class='right'>100%</td> + <td class='right' data-ratio='2 2'>100%</td> </tr> <tr class='file'> @@ -97,17 +105,21 @@ <td>0</td> <td>0</td> - <td class='right'>100%</td> + <td class='right' data-ratio='8 8'>100%</td> </tr> </tbody> </table> + + <p id="no_rows"> + No items found using the specified filter. + </p> </div> <div id='footer'> <div class='content'> <p> - <a class='nav' href='http://nedbatchelder.com/code/coverage/3.5a1'>coverage.py v3.5a1</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/run_a.py b/tests/farm/html/run_a.py index 59cc170..3fabd6f 100644 --- a/tests/farm/html/run_a.py +++ b/tests/farm/html/run_a.py @@ -19,7 +19,8 @@ contains("html_a/a.html", ) contains("html_a/index.html", "<a href='a.html'>a</a>", - "<span class='pc_cov'>67%</span>" + "<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_b_branch.py b/tests/farm/html/run_b_branch.py index d0955a2..0e584a6 100644 --- a/tests/farm/html/run_b_branch.py +++ b/tests/farm/html/run_b_branch.py @@ -22,7 +22,8 @@ contains("html_b_branch/b.html", ) contains("html_b_branch/index.html", "<a href='b.html'>b</a>", - "<span class='pc_cov'>70%</span>" + "<span class='pc_cov'>70%</span>", + "<td class='right' data-ratio='16 23'>70%</td>", ) clean("html_b_branch") diff --git a/tests/test_farm.py b/tests/test_farm.py index 214681e..18c6b4a 100644 --- a/tests/test_farm.py +++ b/tests/test_farm.py @@ -4,7 +4,6 @@ import difflib, filecmp, fnmatch, glob, os, re, shutil, sys from nose.plugins.skip import SkipTest from tests.backtest import run_command, execfile # pylint: disable=W0622 -from tests.coveragetest import CoverageTest from coverage.control import _TEST_NAME_FILE @@ -367,7 +366,7 @@ def main(): # pragma: not covered Commands: run testcase ... - Run specific test case(s) - out testcase ... - Run test cases, but don't clean up, to see the output. + out testcase ... - Run test cases, but don't clean up, leaving output. clean - Clean all the output for all tests. """ diff --git a/tests/test_results.py b/tests/test_results.py index 92c174b..4ce048b 100644 --- a/tests/test_results.py +++ b/tests/test_results.py @@ -58,3 +58,13 @@ class NumbersTest(CoverageTest): self.assertEqual(n9999.pc_covered_str, "0.1") self.assertEqual(n10000.pc_covered_str, "0.0") Numbers.set_precision(0) + + def test_covered_ratio(self): + n = Numbers(n_files=1, n_statements=200, n_missing=47) + self.assertEqual(n.ratio_covered, (153, 200)) + + n = Numbers( + n_files=1, n_statements=200, n_missing=47, + n_branches=10, n_missing_branches=3, n_partial_branches=1000, + ) + self.assertEqual(n.ratio_covered, (160, 210)) |