def test_glbl_reload(self): # fresh start, test default values for k, v in glbl_dict.items(): assert self._glbl[k] == v # update value self._glbl["dk_window"] = 20 self._glbl["auto_dark"] = False self._glbl["_dark_dict_list"] = [{ "acq_time": 0.1, "exposure": 0.5, "timestamp": time.time(), "uid": str(uuid.uuid4()), }] # after update, local yaml should exist assert os.path.isfile(self._glbl["glbl_yaml_path"]) reload_glbl_dict = _reload_glbl() # test contents of reload dict for k, v in self._glbl.items(): assert reload_glbl_dict[k] == v # test equality of glbl objects after setting contents reload_glbl = GlblYamlDict("glbl", **glbl_dict) _set_glbl(reload_glbl, reload_glbl_dict) assert reload_glbl == self._glbl
# configure experiment device being used in current version if glbl_dict['is_simulation']: from xpdacq.simulation import (xpd_pe1c, db, cs700, shctl1, ring_current, fb) pe1c = xpd_pe1c # alias configure_device(area_det=dexela, shutter=shctl1, temp_controller=cs700, db=db, filter_bank=fb, ring_current=ring_current, robot=robot ) # cache previous glbl state reload_glbl_dict = _reload_glbl() from xpdacq.glbl import glbl # reload beamtime from xpdacq.beamtimeSetup import (start_xpdacq, _start_beamtime, _end_beamtime) bt = start_xpdacq() if bt is not None: print("INFO: Reload beamtime objects:\n{}\n".format(bt)) if reload_glbl_dict is not None: _set_glbl(glbl, reload_glbl_dict) # import necessary modules from xpdacq.xpdacq import * from xpdacq.beamtime import *