From 18ba48b6b119f07f5c738c7fd36c2d2ede04f67e Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 19 Oct 2013 21:21:10 -0400 Subject: We only run on 2.6, 2.7, 3.2, 3.3 now. --HG-- branch : 4.0 --- tests/test_process.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'tests/test_process.py') diff --git a/tests/test_process.py b/tests/test_process.py index c49d90a9..d1107e32 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -324,23 +324,20 @@ class ProcessTest(CoverageTest): out_py = self.run_command("python run_me.py") self.assertMultiLineEqual(out_cov, out_py) - if sys.version_info >= (2, 6): - # Doesn't work in 2.5, and I don't care! For some reason, python -m - # in 2.5 has __builtins__ as a dictionary instead of a module? - def test_coverage_run_dashm_is_like_python_dashm(self): - # These -m commands assume the coverage tree is on the path. - out_cov = self.run_command("coverage run -m tests.try_execfile") - out_py = self.run_command("python -m tests.try_execfile") - self.assertMultiLineEqual(out_cov, out_py) + def test_coverage_run_dashm_is_like_python_dashm(self): + # These -m commands assume the coverage tree is on the path. + out_cov = self.run_command("coverage run -m tests.try_execfile") + out_py = self.run_command("python -m tests.try_execfile") + self.assertMultiLineEqual(out_cov, out_py) - def test_coverage_run_dashm_is_like_python_dashm_off_path(self): - # https://bitbucket.org/ned/coveragepy/issue/242 - tryfile = os.path.join(here, "try_execfile.py") - self.make_file("sub/__init__.py", "") - self.make_file("sub/run_me.py", open(tryfile).read()) - out_cov = self.run_command("coverage run -m sub.run_me") - out_py = self.run_command("python -m sub.run_me") - self.assertMultiLineEqual(out_cov, out_py) + def test_coverage_run_dashm_is_like_python_dashm_off_path(self): + # https://bitbucket.org/ned/coveragepy/issue/242 + tryfile = os.path.join(here, "try_execfile.py") + self.make_file("sub/__init__.py", "") + self.make_file("sub/run_me.py", open(tryfile).read()) + out_cov = self.run_command("coverage run -m sub.run_me") + out_py = self.run_command("python -m sub.run_me") + self.assertMultiLineEqual(out_cov, out_py) if sys.version_info >= (2, 7): # Coverage isn't bug-for-bug compatible in the behavior of -m for -- cgit v1.2.1 From bad63e02b113626a048ea5eb253293c61902e291 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 19 Oct 2013 22:08:37 -0400 Subject: Generator expressons are ok now. --HG-- branch : 4.0 --- tests/test_process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/test_process.py') diff --git a/tests/test_process.py b/tests/test_process.py index d1107e32..4453fc57 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -270,7 +270,7 @@ class ProcessTest(CoverageTest): if '__pypy__' in sys.builtin_module_names: # Pypy has an extra frame in the traceback for some reason lines2 = out2.splitlines() - out2 = "".join([l+"\n" for l in lines2 if "toplevel" not in l]) + out2 = "".join(l+"\n" for l in lines2 if "toplevel" not in l) self.assertMultiLineEqual(out, out2) # But also make sure that the output is what we expect. -- cgit v1.2.1 From 6b6a4488adc12d390c5e0c8f13829dd9bf125309 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 20 Oct 2013 07:58:57 -0400 Subject: with statements: no more finally close --HG-- branch : 4.0 --- tests/test_process.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'tests/test_process.py') diff --git a/tests/test_process.py b/tests/test_process.py index 4453fc57..1ab56e8f 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -572,16 +572,13 @@ class ProcessStartupTest(CoverageTest): g = glob.glob(os.path.join(d, "*.pth")) if g: pth_path = os.path.join(d, "subcover.pth") - pth = open(pth_path, "w") - try: + with open(pth_path, "w") as pth: try: pth.write(pth_contents) self.pth_path = pth_path break except (IOError, OSError): # pragma: not covered pass - finally: - pth.close() else: # pragma: not covered raise Exception("Couldn't find a place for the .pth file") -- cgit v1.2.1 From 50959ccaaa07ccfb5a01cb38eb5d2b548e0dfe9a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 20 Oct 2013 08:11:50 -0400 Subject: Not going to use print functions, but at least make them all look the same. --HG-- branch : 4.0 --- tests/test_process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test_process.py') diff --git a/tests/test_process.py b/tests/test_process.py index 1ab56e8f..ddbbafd6 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -35,7 +35,7 @@ class ProcessTest(CoverageTest): import covmod1 import covmodzip1 a = 1 - print ('done') + print('done') """) self.assert_doesnt_exist(".coverage") @@ -52,7 +52,7 @@ class ProcessTest(CoverageTest): else: c = 1 d = 1 - print ('done') + print('done') """) out = self.run_command("coverage -x -p b_or_c.py b") @@ -88,7 +88,7 @@ class ProcessTest(CoverageTest): else: c = 1 d = 1 - print ('done') + print('done') """) out = self.run_command("coverage -x -p b_or_c.py b") @@ -128,7 +128,7 @@ class ProcessTest(CoverageTest): else: c = 1 d = 1 - print ('done') + print('done') """) self.make_file(".coveragerc", """\ -- cgit v1.2.1