From: <fwi...@us...> - 2008-08-05 22:51:05
|
Revision: 5085 http://jython.svn.sourceforge.net/jython/?rev=5085&view=rev Author: fwierzbicki Date: 2008-08-05 22:51:03 +0000 (Tue, 05 Aug 2008) Log Message: ----------- Fix test_pkgimport for Jython. Now deleting $py.class files on Jython, and using __builtin__ instead of the CPython implementatin specific __buitlins__. Modified Paths: -------------- branches/asm/Lib/test/test_pkgimport.py Modified: branches/asm/Lib/test/test_pkgimport.py =================================================================== --- branches/asm/Lib/test/test_pkgimport.py 2008-08-05 22:45:16 UTC (rev 5084) +++ branches/asm/Lib/test/test_pkgimport.py 2008-08-05 22:51:03 UTC (rev 5085) @@ -1,6 +1,6 @@ import os, sys, string, random, tempfile, unittest -from test.test_support import run_unittest +from test.test_support import run_unittest, is_jython class TestImport(unittest.TestCase): @@ -35,10 +35,16 @@ self.remove_modules() def rewrite_file(self, contents): - for extension in "co": - compiled_path = self.module_path + extension + if is_jython: + compiled_path = self.module_path.replace(".", "$") + ".class" if os.path.exists(compiled_path): os.remove(compiled_path) + else: + for extension in "co": + compiled_path = self.module_path + extension + if os.path.exists(compiled_path): + os.remove(compiled_path) + f = open(self.module_path, 'w') f.write(contents) f.close() @@ -56,8 +62,9 @@ not hasattr(sys.modules[self.package_name], 'foo')) # ...make up a variable name that isn't bound in __builtins__ + import __builtin__ var = 'a' - while var in dir(__builtins__): + while var in dir(__builtin__): var += random.choose(string.letters) # ...make a module that just contains that This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |