summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2018-11-18 10:40:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2018-11-18 10:40:07 -0500
commit55ab51bdae6e578f544926da777246ca0ab369e3 (patch)
treea73ee82feb022ced31ea35493d89445ea9736e53 /tests
parent2eedae529974aa0eb0aff7bd411b3b9cd2e9e8aa (diff)
downloadpython-coveragepy-git-55ab51bdae6e578f544926da777246ca0ab369e3.tar.gz
Convert farm/run/run_xxx.py to a test_summary.py test
Diffstat (limited to 'tests')
-rw-r--r--tests/farm/run/run_xxx.py15
-rw-r--r--tests/farm/run/src/xxx11
-rw-r--r--tests/test_summary.py16
3 files changed, 16 insertions, 26 deletions
diff --git a/tests/farm/run/run_xxx.py b/tests/farm/run/run_xxx.py
deleted file mode 100644
index 3caba0ec..00000000
--- a/tests/farm/run/run_xxx.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
-
-copy("src", "out_xxx")
-run("""
- coverage run xxx
- coverage report
- """, rundir="out_xxx", outfile="stdout.txt")
-contains("out_xxx/stdout.txt",
- "xxx: 3 4 0 7",
- "\nxxx ", # The reporting line for xxx
- " 7 1 86%" # The reporting data for xxx
- )
-doesnt_contain("out_xxx/stdout.txt", "No such file or directory")
-clean("out_xxx")
diff --git a/tests/farm/run/src/xxx b/tests/farm/run/src/xxx
deleted file mode 100644
index 818c7f93..00000000
--- a/tests/farm/run/src/xxx
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
-# For details: https://github.com/nedbat/coveragepy/blob/master/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
-b = 4
-if not b:
- c = 6
-d = 7
-print("xxx: %r %r %r %r" % (a, b, c, d))
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 51bedb6d..f0e8956e 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -564,6 +564,22 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
self.assertEqual(self.line_count(report), 3)
self.assertIn('No data to report.', report)
+ def test_report_no_extension(self):
+ self.make_file("xxx", """\
+ # This is a python file though it doesn't look like it, like a main script.
+ a = b = c = d = 0
+ a = 3
+ b = 4
+ if not b:
+ c = 6
+ d = 7
+ print("xxx: %r %r %r %r" % (a, b, c, d))
+ """)
+ out = self.run_command("coverage run xxx")
+ self.assertEqual(out, "xxx: 3 4 0 7\n")
+ report = self.report_from_command("coverage report")
+ self.assertEqual(self.last_line_squeezed(report), "xxx 7 1 86%")
+
def get_report(self, cov):
"""Get the report from `cov`, and canonicalize it."""
repout = StringIO()