summaryrefslogtreecommitdiff
path: root/tests/test_summary_class.py
diff options
context:
space:
mode:
authorDan Wandschneider <daniel.wandschneider@schrodinger.com>2016-06-08 19:51:55 -0400
committerDan Wandschneider <daniel.wandschneider@schrodinger.com>2016-06-08 19:51:55 -0400
commita488a33ac1cb1d8443681814ee8c5d167e129e0d (patch)
tree313e7ec8d4e6606eb8ae54e40113d54eb5ce4f4e /tests/test_summary_class.py
parent0c39e2f5774b78ca5025e8ffe0fbde4ab2e86abf (diff)
downloadpython-coveragepy-git-a488a33ac1cb1d8443681814ee8c5d167e129e0d.tar.gz
Issue 199: Sort text report.
Allows sorting of the text report based on: Name, Stmts, Miss, Cover Tested on Mac with Python 2.7.11 and Python 3.5 Help message for the new option is: python -m coverage report -h ... --sort=SORT Sort report by a column. Valid values are: Name, Stmts, Miss, Cover. ...
Diffstat (limited to 'tests/test_summary_class.py')
-rw-r--r--tests/test_summary_class.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_summary_class.py b/tests/test_summary_class.py
index 93e025c4..2a8cd7c6 100644
--- a/tests/test_summary_class.py
+++ b/tests/test_summary_class.py
@@ -51,3 +51,15 @@ class TestSummaryReporterConfiguration(unittest.TestCase):
report = self.get_summary_text(data, opts)
self.assertIn('Missing', report)
self.assertNotIn('Branch', report)
+
+ def test_sort_report(self):
+ """Sort the text report."""
+ data = self.get_coverage_data()
+ opts = config.CoverageConfig()
+ opts.from_args(sort='Stmts')
+ report = self.get_summary_text(data, opts)
+ # just the basename, to avoid pyc and directory name complexities
+ filename = os.path.splitext(os.path.basename(__file__))[0]
+ location1 = report.find('helpers')
+ location2 = report.find(filename)
+ self.assertLess(location1, location2)