def test_new_loading_style(self): """Test loading rez plugin from python modules""" with restore_sys_path(): sys.path.append(self.data_path("extensions")) cloud_cls = plugin_manager.get_plugin_class( "package_repository", "cloud") self.assertEqual(cloud_cls.name(), "cloud")
def test_plugin_override_2(self): """Test plugin from python modules can override the default""" with restore_sys_path(): sys.path.append(self.data_path("extensions")) mem_cls = plugin_manager.get_plugin_class("package_repository", "memory") self.assertEqual("bar", mem_cls.on_test)
def test_apply(self): """Test apply() function.""" # Isolate our changes to os.environ and sys.path and return to the # original state to not mess with our test environment. with restore_os_environ(), restore_sys_path(): r = ResolvedContext(["hello_world"]) r.apply() self.assertEqual(os.environ.get("OH_HAI_WORLD"), "hello")
def test_plugin_override_3(self): """Test plugin from python modules can override plugin_path""" with restore_sys_path(): # setup new sys.path.append(self.data_path("extensions")) # setup old self.update_settings( dict(plugin_path=[self.data_path("extensions", "non-mod")])) mem_cls = plugin_manager.get_plugin_class("package_repository", "memory") self.assertEqual("bar", mem_cls.on_test)