summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmdline.py7
-rw-r--r--tests/test_summary_class.py12
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index 8e2840b4..1fefb029 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -43,7 +43,7 @@ class BaseCmdLineTest(CoverageTest):
)
defaults.report(
ignore_errors=None, include=None, omit=None, morfs=[],
- show_missing=None, skip_covered=None
+ show_missing=None, skip_covered=None, sort_name=None
)
defaults.xml_report(
ignore_errors=None, include=None, omit=None, morfs=[], outfile=None,
@@ -341,6 +341,11 @@ class CmdLineTest(BaseCmdLineTest):
.load()
.report(skip_covered=True)
""")
+ self.cmd_executes("report --sort Stmts", """\
+ .coverage()
+ .load()
+ .report(sort_name='Stmts')
+ """)
def test_run(self):
# coverage run [-p] [-L] [--timid] MODULE.py [ARG1 ARG2 ...]
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)