def test_calib_md(fresh_xrun, exp_hash_uid, glbl, db): xrun = fresh_xrun # calib run sample_md = _sample_name_phase_info_configuration(None, None, "calib") calibrant = os.path.join(glbl["usrAnalysis_dir"], "Ni24.D") detector = "perkin_elmer" _collect_img( 5, True, sample_md, xrun, detector=detector, calibrant=calibrant, ) calib_hdr = db[-1] assert "Ni_calib" == calib_hdr.start["sample_name"] assert detector == calib_hdr.start["detector"] calibrant_obj = Calibrant(calibrant) start_doc = calib_hdr.start assert calibrant_obj.dSpacing == start_doc["dSpacing"] assert start_doc["is_calibration"] for k, expected in sample_md.items(): actual = start_doc[k] assert expected == actual server_uid = start_doc["detector_calibration_server_uid"] client_uid = start_doc["detector_calibration_client_uid"] assert server_uid == exp_hash_uid assert server_uid == client_uid # production run xrun(0, 0) hdr = db[-1] client_uid = hdr.start["detector_calibration_client_uid"] assert client_uid == exp_hash_uid assert "detector_calibration_server_uid" not in hdr.start # new uid new_hash = update_experiment_hash_uid() # production run first xrun(0, 0) hdr = db[-1] client_uid = hdr.start["detector_calibration_client_uid"] assert client_uid == new_hash assert "detector_calibration_server_uid" not in hdr.start # new calib run _collect_img( 5, True, sample_md, xrun, detector=detector, calibrant=calibrant, ) calib_hdr = db[-1] server_uid = calib_hdr.start["detector_calibration_server_uid"] client_uid = calib_hdr.start["detector_calibration_client_uid"] assert server_uid == new_hash assert server_uid == client_uid # md link calib_server_uid = calib_hdr.start["detector_calibration_server_uid"] hdr_client_uid = hdr.start["detector_calibration_client_uid"] assert calib_server_uid == hdr_client_uid
def test_configure_sample_info_md(sample_name, phase_info, tag, sample_md): parsed_sample_md = _sample_name_phase_info_configuration( sample_name, phase_info, tag) assert parsed_sample_md == sample_md
def test_configure_sample_info_args(sample_name, phase_info, tag, exception): if exception is None: _sample_name_phase_info_configuration(sample_name, phase_info, tag) else: with pytest.raises(exception): _sample_name_phase_info_configuration(sample_name, phase_info, tag)