def test_scans_init(): scansin=load_scans(222,243) try: npysc.Scans(scans_dict=scansin) except: pytest.failed('could not build scan collection')
def setup_colibri_imx7(request, clean_image): latest_uboot = latest_build_artifact(clean_image['build_dir'], "u-boot-nand.imx") latest_ubimg = latest_build_artifact(clean_image['build_dir'], ".ubimg") if not latest_uboot: pytest.fail('failed to find U-Boot binary') if not latest_ubimg: pytest.failed('failed to find latest ubimg for the board') def board_setup(): common_board_setup(files=[latest_ubimg, latest_uboot], remote_path='/tmp', image_file=os.path.basename(latest_ubimg)) execute(board_setup, hosts=conftest.current_hosts()) def board_cleanup(): def board_cleanup_impl(): common_board_cleanup() execute(board_cleanup_impl, hosts=conftest.current_hosts()) request.addfinalizer(board_cleanup)
def load_scans(start,stop): """ Creates a dictionary of scans for use in other test functions """ scansin={} try: for idx in range(start,stop+1): scansin[idx]=npyio.load_data(os.path.join(os.path.dirname(__file__),'filetypes/HB1A/HB1A_exp0718_scan0%d.dat'%idx)) return scansin except: pytest.failed('scan load failed in scan collection test')
def load_scans(start,stop): """ Creates a dictionary of scans for use in other test functions """ scansin=collections.OrderedDict() try: for idx in range(start,stop+1): scansin[idx]=npyio.load_data(os.path.join(os.path.dirname(__file__),'filetypes/HB1A/HB1A_exp0718_scan0%d.dat'%idx)) return scansin except: pytest.failed('scan load failed in scan collection test')
def test_scans_init(): #load file scansin=load_scans(222,243) # check expecteed execution try: tst_obj=npysc.Scans(scans_dict=scansin) except: pytest.failed('could not build scan collection') # check if appropriate error is raise if not an ordered dict. dict_scans=dict(scansin) with pytest.raises(RuntimeError) as excinfo: npysc.Scans(scans_dict=dict_scans) assert 'type OrderedDict' in str(excinfo.value) # check that update raises the proper error with pytest.raises(RuntimeError) as excinfo: tst_obj.update(dict_scans) assert 'type OrderedDict' in str(excinfo.value)