def test_ds_no_exist(no_exist_present_ds): url = 'localds://bogus2' try: resolve_local_ds_url(url) assert False except GridDsException: pass
def test_local_ds_notfound(): url = 'file:///bogus.root' try: resolve_local_ds_url(url) assert False except FileNotFoundError: pass
def test_weird_url_scheme(): url = 'bogus://dataset_du_jour' try: resolve_local_ds_url(url) assert False except GridDsException: pass
def test_local_ds_good(): with NamedTemporaryFile() as f: f.write(b'hi') url = f'file:///{f.name}' r = resolve_local_ds_url(url) assert r is not None assert len(r) == 1 assert r[0] == url
def test_ds_good(already_present_ds): url = 'localds://mc16_13TeV.311309.MadGraphPythia8EvtGen_A14NNPDF31LO_HSS_LLP_mH125_mS5_ltlow.deriv.DAOD_EXOT15.e7270_e5984_s3234_r10724_r10726_p3795' r = resolve_local_ds_url(url) already_present_ds.assert_called_once_with('http://localhost:8000/ds?ds_name=mc16_13TeV.311309.MadGraphPythia8EvtGen_A14NNPDF31LO_HSS_LLP_mH125_mS5_ltlow.deriv.DAOD_EXOT15.e7270_e5984_s3234_r10724_r10726_p3795') assert r is not None assert len(r) == 7 for i in range(1,7): assert f'file:///mc16_13TeV.311309.MadGraphPythia8EvtGen_A14NNPDF31LO_HSS_LLP_mH125_mS5_ltlow.deriv.DAOD_EXOT15.e7270_e5984_s3234_r10724_r10726_p3795/DAOD_EXOT15.17545510._00000{i}.pool.root.1' in r
def test_ds_downloading(downloading_present_ds): url = 'localds://bogus2' r = resolve_local_ds_url(url) assert r is None
def test_df_good(local_ds_file): url = f'file:///{local_ds_file}' r = resolve_local_ds_url(url) assert r is not None assert len(r) == 1 assert r[0] is url
def test_root_url_scheme(): url = 'root://eosuser.cern.ch/gwatts/user' r = resolve_local_ds_url(url) assert len(r) == 1 assert r[0] == url