1
0
forked from VimPlug/jedi

remove RessourceWarning from Python3 tests

This commit is contained in:
David Halter
2012-11-20 15:56:15 +01:00
parent 8ce2633c06
commit 1d3ee0237e
2 changed files with 6 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
from __future__ import with_statement
from _compatibility import exec_function, is_py3k
import re
@@ -92,7 +93,7 @@ class Parser(CachedModule):
}
if is_py3k:
map_types['file object'] = 'import io; return io.TextIOWrapper(file)'
map_types['file object'] = 'import io; return io.TextIOWrapper()'
module_cache = {}
@@ -193,11 +194,12 @@ class Parser(CachedModule):
if name == '__builtin__' and not is_py3k:
name = 'builtins'
path = os.path.dirname(os.path.abspath(__file__))
f = open(os.path.sep.join([path, 'mixin', name]) + '.py')
with open(os.path.sep.join([path, 'mixin', name]) + '.py') as f:
s = f.read()
except IOError:
return {}
else:
mixin_dct = process_code(f.read())
mixin_dct = process_code(s)
if is_py3k and self.name == Builtin.name:
# in the case of Py3k xrange is now range
mixin_dct['range'] = mixin_dct['xrange']

View File

@@ -239,6 +239,7 @@ class ImportPath(object):
source = f.read()
else:
source = current_namespace[0].read()
current_namespace[0].close()
if path.endswith('.py'):
f = modules.Module(path, source)
else: