forked from VimPlug/jedi
remove RessourceWarning from Python3 tests
This commit is contained in:
+5
-3
@@ -1,3 +1,4 @@
|
|||||||
|
from __future__ import with_statement
|
||||||
from _compatibility import exec_function, is_py3k
|
from _compatibility import exec_function, is_py3k
|
||||||
|
|
||||||
import re
|
import re
|
||||||
@@ -92,7 +93,7 @@ class Parser(CachedModule):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if is_py3k:
|
if is_py3k:
|
||||||
map_types['file object'] = 'import io; return io.TextIOWrapper(file)'
|
map_types['file object'] = 'import io; return io.TextIOWrapper()'
|
||||||
|
|
||||||
module_cache = {}
|
module_cache = {}
|
||||||
|
|
||||||
@@ -193,11 +194,12 @@ class Parser(CachedModule):
|
|||||||
if name == '__builtin__' and not is_py3k:
|
if name == '__builtin__' and not is_py3k:
|
||||||
name = 'builtins'
|
name = 'builtins'
|
||||||
path = os.path.dirname(os.path.abspath(__file__))
|
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:
|
except IOError:
|
||||||
return {}
|
return {}
|
||||||
else:
|
else:
|
||||||
mixin_dct = process_code(f.read())
|
mixin_dct = process_code(s)
|
||||||
if is_py3k and self.name == Builtin.name:
|
if is_py3k and self.name == Builtin.name:
|
||||||
# in the case of Py3k xrange is now range
|
# in the case of Py3k xrange is now range
|
||||||
mixin_dct['range'] = mixin_dct['xrange']
|
mixin_dct['range'] = mixin_dct['xrange']
|
||||||
|
|||||||
@@ -239,6 +239,7 @@ class ImportPath(object):
|
|||||||
source = f.read()
|
source = f.read()
|
||||||
else:
|
else:
|
||||||
source = current_namespace[0].read()
|
source = current_namespace[0].read()
|
||||||
|
current_namespace[0].close()
|
||||||
if path.endswith('.py'):
|
if path.endswith('.py'):
|
||||||
f = modules.Module(path, source)
|
f = modules.Module(path, source)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user