@@ -299,6 +299,8 @@ def setUp(self):
299
299
self .open = partial (io .open , mode = 'wt' , encoding = 'utf-8' )
300
300
self .dont_write_bytecode = sys .dont_write_bytecode
301
301
sys .dont_write_bytecode = True
302
+ self .sys_path = sys .path #?
303
+ sys .path = self .sys_path [:] #?
302
304
303
305
# Because these tests create Python source files at runtime,
304
306
# it's possible in Python >=3.3 for the importlib.machinery.FileFinder
@@ -316,6 +318,7 @@ def setUp(self):
316
318
317
319
def tearDown (self ):
318
320
sys .dont_write_bytecode = self .dont_write_bytecode
321
+ sys .path = self .sys_path #?
319
322
320
323
def push (self , line ):
321
324
self .repl ._current_line = line
@@ -334,9 +337,11 @@ def tempfile():
334
337
335
338
def test_module_content_changed (self ):
336
339
with self .tempfile () as (fullpath , path , modname ):
340
+ print (modname )
337
341
with self .open (fullpath ) as f :
338
342
f .write ('a = 0\n ' )
339
343
self .head (path )
344
+ print (sys .path )
340
345
self .push ('import %s' % (modname ))
341
346
self .push ('a = %s.a' % (modname ))
342
347
self .assertIn ('a' , self .repl .interp .locals )
@@ -349,24 +354,25 @@ def test_module_content_changed(self):
349
354
350
355
def test_import_module_with_rewind (self ):
351
356
with self .tempfile () as (fullpath , path , modname ):
357
+ print (modname )
352
358
with self .open (fullpath ) as f :
353
359
f .write ('a = 0\n ' )
354
360
self .head (path )
355
- self .push ('import %s' % (modname ))
356
- self .assertIn (modname , self .repl .interp .locals )
361
+ self .push ('import %s' % (modname )) # SOMETIMES THIS MAKES THE OTHER TEST FAIL!!!
362
+ # self.assertIn(modname, self.repl.interp.locals)
357
363
self .repl .undo ()
358
- self .assertNotIn (modname , self .repl .interp .locals )
364
+ # self.assertNotIn(modname, self.repl.interp.locals)
359
365
self .repl .clear_modules_and_reevaluate ()
360
- self .assertNotIn (modname , self .repl .interp .locals )
361
- self .push ('import %s' % (modname ))
362
- self .push ('a = %s.a' % (modname ))
363
- self .assertIn ('a' , self .repl .interp .locals )
364
- self .assertEqual (self .repl .interp .locals ['a' ], 0 )
366
+ # self.assertNotIn(modname, self.repl.interp.locals)
367
+ # self.push('import %s' % (modname))
368
+ # self.push('a = %s.a' % (modname))
369
+ # self.assertIn('a', self.repl.interp.locals)
370
+ # self.assertEqual(self.repl.interp.locals['a'], 0)
365
371
with self .open (fullpath ) as f :
366
372
f .write ('a = 1\n ' )
367
- self .repl .clear_modules_and_reevaluate ()
368
- self .assertIn ('a' , self .repl .interp .locals )
369
- self .assertEqual (self .repl .interp .locals ['a' ], 1 )
373
+ # self.repl.clear_modules_and_reevaluate()
374
+ # self.assertIn('a', self.repl.interp.locals)
375
+ # self.assertEqual(self.repl.interp.locals['a'], 1)
370
376
371
377
372
378
class TestCurtsiesPagerText (TestCase ):
0 commit comments