def reload_zmirror(self, configs_dict=None):
self.del_temp_var()
import config
importlib.reload(config)
test_config_names = (name for name in dir(self.C) if name[:2] != '__' and name[-2:] != '__')
for config_name in test_config_names:
config_value = getattr(self.C, config_name)
setattr(config, config_name, config_value)
if configs_dict is not None:
for config_name, config_value in configs_dict.items():
setattr(config, config_name, config_value)
import zmirror.cache_system as cache_system
import zmirror.zmirror as zmirror
importlib.reload(cache_system)
importlib.reload(zmirror)
zmirror.app.config['TESTING'] = True
# ?????????, ? del_temp_var() ???
if hasattr(self.C, "my_host_port"):
port = getattr(self.C, "my_host_port", None)
my_host_name = getattr(self.C, "my_host_name", "127.0.0.1")
if port is not None:
self.C.my_host_name_no_port = my_host_name
self.C.my_host_name = self.C.my_host_name_no_port + ":" + str(port)
else:
self.C.my_host_name_no_port = my_host_name
elif hasattr(self.C, "my_host_name"):
self.C.my_host_name_no_port = self.C.my_host_name
self.client = zmirror.app.test_client() # type: FlaskClient
self.app = zmirror.app # type: Flask
self.zmirror = zmirror
评论列表
文章目录