def test_deepreload():
 with TemporaryDirectory() as tmpdir:
  with prepended_to_syspath(tmpdir):
   with open(os.path.join(tmpdir, 'A.py'), 'w') as f:
    f.write('class Object(object):\n    pass\n')
   with open(os.path.join(tmpdir, 'B.py'), 'w') as f:
    f.write('import A\n')
   import A
   import B
   obj = A.Object()
   dreload(B, exclude=['A'])
   nt.assert_true(isinstance(obj, A.Object))
   obj = A.Object()
   dreload(B)
   nt.assert_false(isinstance(obj, A.Object))

def test_deepreload ( ) : with TemporaryDirectory ( ) as tmpdir : with prepended_to_syspath ( tmpdir ) : with open ( os . path . join ( tmpdir , 'A.py' ) , 'w' ) as f : f . write ( 'class Object(object):\n    pass\n' ) with open ( os . path . join ( tmpdir , 'B.py' ) , 'w' ) as f : f . write ( 'import A\n' ) import A import B obj = A . Object ( ) dreload ( B , exclude = [ 'A' ] ) nt . assert_true ( isinstance ( obj , A . Object ) ) obj = A . Object ( ) dreload ( B ) nt . assert_false ( isinstance ( obj , A . Object ) )
test that dreload does deep reloads and skips excluded modules .