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
commit743058bbaf63df4e1dd32e565210eee39019fd1e (patch)
tree83ff018082cd8c296e41fd6d1e393692880ace56 /tests/test_summary_class.py
parent3c214385710b6ecb10c8ac59a3f7e50384e654e4 (diff)
downloadpython-coveragepy-git-743058bbaf63df4e1dd32e565210eee39019fd1e.tar.gz
Use caoverage.py's canonical backwards compatibility infrastructure in new test.
Diffstat (limited to 'tests/test_summary_class.py')
-rw-r--r--tests/test_summary_class.py23
1 files changed, 5 insertions, 18 deletions
diff --git a/tests/test_summary_class.py b/tests/test_summary_class.py
index bc4466bc..fb455920 100644
--- a/tests/test_summary_class.py
+++ b/tests/test_summary_class.py
@@ -5,17 +5,10 @@
"""Test text-based summary reporter for coverage.py"""
import collections
-import unittest
import os.path
import sys
-if sys.version_info < (3, ):
- try:
- from cStringIO import StringIO
- except ImportError:
- from StringIO import StringIO
-else:
- from io import StringIO
-from coverage import summary, data, control, config
+from coverage.backward import StringIO
+from coverage import backunittest, config, control, data, summary
LINES_1 = {
__file__: {-1: 1, 7: 1},
@@ -23,7 +16,7 @@ LINES_1 = {
}
-class TestSummaryReporterConfiguration(unittest.TestCase):
+class TestSummaryReporterConfiguration(backunittest.TestCase):
def get_coverage_data(self, lines=LINES_1):
"""Get a CoverageData object that includes the requested lines."""
data1 = data.CoverageData()
@@ -57,10 +50,7 @@ class TestSummaryReporterConfiguration(unittest.TestCase):
opts = config.CoverageConfig()
opts.from_args(show_missing=True)
report = self.get_summary_text(data, opts)
- if sys.version_info > (2, 7):
- self.assertIn('Missing', report)
- else:
- self.assertTrue('Missing' in report)
+ self.assertTrue('Missing' in report)
self.assertNotIn('Branch', report)
def test_sort_report(self):
@@ -73,7 +63,4 @@ class TestSummaryReporterConfiguration(unittest.TestCase):
filename = os.path.splitext(os.path.basename(__file__))[0]
location1 = report.find('helpers')
location2 = report.find(filename)
- if sys.version_info > (2, 7):
- self.assertLess(location1, location2)
- else:
- self.assertTrue(location1 < location2)
+ self.assertTrue(location1 < location2)