summaryrefslogtreecommitdiff
path: root/test/test_execfile.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-05-09 10:02:21 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-05-09 10:02:21 -0400
commit2018118c60a8f8f3738550eed292ae43c5c4df5d (patch)
treeab2958a7d213f9599f47e047c2807d014ef26d5e /test/test_execfile.py
parentfce62d380f82f6a650a8297341bff3044400b4f9 (diff)
downloadpython-coveragepy-git-2018118c60a8f8f3738550eed292ae43c5c4df5d.tar.gz
Change run_python_file again so that it doesn't produce compiled turds in the file system.
Diffstat (limited to 'test/test_execfile.py')
-rw-r--r--test/test_execfile.py26
1 files changed, 10 insertions, 16 deletions
diff --git a/test/test_execfile.py b/test/test_execfile.py
index 60ef1952..fc5b52a4 100644
--- a/test/test_execfile.py
+++ b/test/test_execfile.py
@@ -17,11 +17,9 @@ class RunTest(CoverageTest):
# The file should think it is __main__
self.assertEqual(mod_globs['__name__'], "__main__")
- # It should seem to come from a file named try_execfile
- dunder_file = os.path.splitext(
- os.path.basename(mod_globs['__file__'])
- )[0]
- self.assertEqual(dunder_file, "try_execfile")
+ # It should seem to come from a file named try_execfile.py
+ dunder_file = os.path.basename(mod_globs['__file__'])
+ self.assertEqual(dunder_file, "try_execfile.py")
# It should have its correct module data.
self.assertEqual(mod_globs['__doc__'],
@@ -35,16 +33,12 @@ class RunTest(CoverageTest):
# Argv should have the proper values.
self.assertEqual(mod_globs['argv'], [tryfile, "arg1", "arg2"])
- def test_no_c_file(self):
- self.makeFile("mycode.py", """\
- a = 1
- b = 2
- if b == 3:
- c = 4
- d = 5
+ def test_no_extra_file(self):
+ # Make sure that running a file doesn't create an extra compiled file.
+ self.makeFile("xxx", """\
+ print "a non-.py file!"
""")
- self.assert_(not os.path.exists(".coverage"))
- self.run_command("coverage -x mycode.py")
- self.assert_(os.path.exists(".coverage"))
- \ No newline at end of file
+ self.assertEqual(os.listdir("."), ["xxx"])
+ run_python_file("xxx", ["xxx"])
+ self.assertEqual(os.listdir("."), ["xxx"])