From: <pj...@us...> - 2009-05-31 01:01:44
|
Revision: 6432 http://jython.svn.sourceforge.net/jython/?rev=6432&view=rev Author: pjenvey Date: 2009-05-31 00:25:12 +0000 (Sun, 31 May 2009) Log Message: ----------- lame workaround for test_support.make_jar_classloader jar file handles being held onto, for test_classpathimporter on Windows Modified Paths: -------------- trunk/jython/Lib/test/test_support.py Modified: trunk/jython/Lib/test/test_support.py =================================================================== --- trunk/jython/Lib/test/test_support.py 2009-05-30 22:47:39 UTC (rev 6431) +++ trunk/jython/Lib/test/test_support.py 2009-05-31 00:25:12 UTC (rev 6432) @@ -147,9 +147,21 @@ is_jython = sys.platform.startswith('java') if is_jython: def make_jar_classloader(jar): - from java.io import File - from java.net import URLClassLoader - url = File(findfile(jar)).toURL() + import os + from java.net import URL, URLClassLoader + + url = URL('jar:file:%s!/' % jar) + if os._name == 'nt': + # URLJarFiles keep a cached open file handle to the jar even + # after this ClassLoader is GC'ed, disallowing Windows tests + # from removing the jar file from disk when finished with it + conn = url.openConnection() + if conn.getDefaultUseCaches(): + # XXX: Globally turn off jar caching: this stupid + # instance method actually toggles a static flag. Need a + # better fix + conn.setDefaultUseCaches(False) + return URLClassLoader([url]) import os This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |