示例#1
0
 def test_on_change(self):
     x = Autoreloader(Mock(), modules=[__name__])
     mm = x._maybe_modified = Mock(0)
     mm.return_value = True
     x._reload = Mock()
     x._module_name = Mock()
     x.on_change([__name__])
     self.assertTrue(x._reload.called)
     mm.return_value = False
     x.on_change([__name__])
示例#2
0
 def test_on_change(self):
     x = Autoreloader(Mock(), modules=[__name__])
     mm = x._maybe_modified = Mock(0)
     mm.return_value = True
     x._reload = Mock()
     x._module_name = Mock()
     x.on_change([__name__])
     self.assertTrue(x._reload.called)
     mm.return_value = False
     x.on_change([__name__])
示例#3
0
 def test_module_name(self):
     x = Autoreloader(Mock(), modules=[__name__])
     self.assertEqual(x._module_name("foo/bar/baz.py"), "baz")
示例#4
0
 def test_module_name(self):
     x = Autoreloader(Mock(), modules=[__name__])
     self.assertEqual(x._module_name('foo/bar/baz.py'), 'baz')