diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-18 22:52:10 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-01-18 22:52:10 -0500 |
commit | 8dba481b188f4df23074816f9fa8c32a488482e6 (patch) | |
tree | 94df16d98906e0574277b670a6454d04af9a5ff0 /tests/test_process.py | |
parent | 1a6b57d7d181ba4d8eb6098aab7c58670db69ea9 (diff) | |
download | python-coveragepy-git-8dba481b188f4df23074816f9fa8c32a488482e6.tar.gz |
No test failures on Jython
One or two of these are questionable accommodations, but there are no failures.
Diffstat (limited to 'tests/test_process.py')
-rw-r--r-- | tests/test_process.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/test_process.py b/tests/test_process.py index debd0d79..6c5be713 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -1095,7 +1095,7 @@ class UnicodeFilePathsTest(CoverageTest): def setUp(self): super(UnicodeFilePathsTest, self).setUp() if env.JYTHON: - self.skipTest("Jython 2 doesn't like accented file names") + self.skipTest("Jython doesn't like accented file names") def test_accented_dot_py(self): # Make a file with a non-ascii character in the filename. @@ -1237,8 +1237,9 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest): """) # sub.py will write a few lines. self.make_file("sub.py", """\ - with open("out.txt", "w") as f: - f.write("Hello, world!\\n") + f = open("out.txt", "w") + f.write("Hello, world!\\n") + f.close() """) def test_subprocess_with_pth_files(self): # pragma: not covered @@ -1266,7 +1267,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest): self.assert_exists(".mycovdata") data = coverage.CoverageData() data.read_file(".mycovdata") - self.assertEqual(data.line_counts()['sub.py'], 2) + self.assertEqual(data.line_counts()['sub.py'], 3) def test_subprocess_with_pth_files_and_parallel(self): # pragma: not covered # https://bitbucket.org/ned/coveragepy/issues/492/subprocess-coverage-strange-detection-of @@ -1290,7 +1291,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest): self.assert_exists(".coverage") data = coverage.CoverageData() data.read_file(".coverage") - self.assertEqual(data.line_counts()['sub.py'], 2) + self.assertEqual(data.line_counts()['sub.py'], 3) # assert that there are *no* extra data files left over after a combine data_files = glob.glob(os.getcwd() + '/.coverage*') @@ -1347,14 +1348,17 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): # Main will run sub.py. self.make_file(path("main.py"), """\ import %s - if True: pass + a = 2 + b = 3 """ % fullname('sub')) if package: self.make_file(path("__init__.py"), "") # sub.py will write a few lines. self.make_file(path("sub.py"), """\ - with open("out.txt", "w") as f: - f.write("Hello, world!") + # Avoid 'with' so Jython can play along. + f = open("out.txt", "w") + f.write("Hello, world!") + f.close() """) self.make_file("coverage.ini", """\ [run] @@ -1379,7 +1383,7 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest): data.read_file(".coverage") summary = data.line_counts() print(summary) - self.assertEqual(summary[source + '.py'], 2) + self.assertEqual(summary[source + '.py'], 3) self.assertEqual(len(summary), 1) def test_dashm_main(self): |