##// END OF EJS Templates
Merge pull request #2088 from bfroehle/_2083_py32_test_failures...
Thomas Kluyver -
r7811:d6009ff2 merge
parent child Browse files
Show More
@@ -489,6 +489,7 b' def test_extension():'
489 assert 'arq' not in _ip.user_ns
489 assert 'arq' not in _ip.user_ns
490 finally:
490 finally:
491 _ip.ipython_dir = orig_ipython_dir
491 _ip.ipython_dir = orig_ipython_dir
492 tmpdir.cleanup()
492
493
493 def test_notebook_export_json():
494 def test_notebook_export_json():
494 with TemporaryDirectory() as td:
495 with TemporaryDirectory() as td:
@@ -67,7 +67,8 b' class PickleShareDB(collections.MutableMapping):'
67 return self.cache[fil][0]
67 return self.cache[fil][0]
68 try:
68 try:
69 # The cached item has expired, need to read
69 # The cached item has expired, need to read
70 obj = pickle.loads(fil.open("rb").read())
70 with fil.open("rb") as f:
71 obj = pickle.loads(f.read())
71 except:
72 except:
72 raise KeyError(key)
73 raise KeyError(key)
73
74
@@ -82,7 +83,8 b' class PickleShareDB(collections.MutableMapping):'
82 parent.makedirs()
83 parent.makedirs()
83 # We specify protocol 2, so that we can mostly go between Python 2
84 # We specify protocol 2, so that we can mostly go between Python 2
84 # and Python 3. We can upgrade to protocol 3 when Python 2 is obsolete.
85 # and Python 3. We can upgrade to protocol 3 when Python 2 is obsolete.
85 pickled = pickle.dump(value,fil.open('wb'), protocol=2)
86 with fil.open('wb') as f:
87 pickled = pickle.dump(value, f, protocol=2)
86 try:
88 try:
87 self.cache[fil] = (value,fil.mtime)
89 self.cache[fil] = (value,fil.mtime)
88 except OSError as e:
90 except OSError as e:
@@ -73,7 +73,8 b' if sys.version_info[0] >= 3:'
73
73
74 def execfile(fname, glob, loc=None):
74 def execfile(fname, glob, loc=None):
75 loc = loc if (loc is not None) else glob
75 loc = loc if (loc is not None) else glob
76 exec compile(open(fname, 'rb').read(), fname, 'exec') in glob, loc
76 with open(fname, 'rb') as f:
77 exec compile(f.read(), fname, 'exec') in glob, loc
77
78
78 # Refactor print statements in doctests.
79 # Refactor print statements in doctests.
79 _print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE)
80 _print_statement_re = re.compile(r"\bprint (?P<expr>.*)$", re.MULTILINE)
General Comments 0
You need to be logged in to leave comments. Login now