MCPcopy Index your code
hub / github.com/saltstack/salt / test_reload

Method test_reload

tests/unit/test_loader.py:957–996  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

955
956 @pytest.mark.slow_test
957 def test_reload(self):
958 # ensure it doesn't exist
959 self.assertNotIn(self.module_key, self.loader)
960
961 # update both the module and the lib
962 for x in range(1, 3):
963 self.update_lib()
964 self.update_module()
965 self.loader.clear()
966 self.assertNotIn(self.module_key, self.loader._dict)
967 self.assertIn(self.module_key, self.loader)
968 self.assertEqual(
969 self.loader[self.module_key](), (self.count, self.lib_count)
970 )
971
972 # update just the module
973 for x in range(1, 3):
974 self.update_module()
975 self.loader.clear()
976 self.assertNotIn(self.module_key, self.loader._dict)
977 self.assertIn(self.module_key, self.loader)
978 self.assertEqual(
979 self.loader[self.module_key](), (self.count, self.lib_count)
980 )
981
982 # update just the lib
983 for x in range(1, 3):
984 self.update_lib()
985 self.loader.clear()
986 self.assertNotIn(self.module_key, self.loader._dict)
987 self.assertIn(self.module_key, self.loader)
988 self.assertEqual(
989 self.loader[self.module_key](), (self.count, self.lib_count)
990 )
991
992 self.rm_module()
993 # make sure that even if we remove the module, its still loaded until a clear
994 self.assertEqual(self.loader[self.module_key](), (self.count, self.lib_count))
995 self.loader.clear()
996 self.assertNotIn(self.module_key, self.loader)
997
998 @pytest.mark.slow_test
999 def test_reload_missing_lib(self):

Callers

nothing calls this directly

Calls 4

update_libMethod · 0.95
update_moduleMethod · 0.95
rm_moduleMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected