diff --git a/catalogbuilder/tests/create_catalog_test.py b/catalogbuilder/tests/create_catalog_test.py index 63c8973..75aaae1 100644 --- a/catalogbuilder/tests/create_catalog_test.py +++ b/catalogbuilder/tests/create_catalog_test.py @@ -1,19 +1,26 @@ #!/usr/bin/env python -@pytest.mark.skip(reason="this can only work with a conda installed catalogbuilder now") -#TODO test after conda pkg is published and make changes as needed from catalogbuilder.scripts import gen_intake_gfdl #from . import gen_intake_gfdl import sys - -#the following 2 lines are to generate sample data, remove it as needed in your runscript +#the following line is to generate sample data, remove it as needed in your runscript import make_sample_data -make_sample_data.make_sample_data() -input_path = "archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp" -output_path = "test" -try: - gen_intake_gfdl.create_catalog(input_path,output_path) -except: - sys.exit("Exception occured calling gen_intake_gfdl.create_catalog") +@pytest.mark.skip +def create_catalog(sample=True): + if(sample == True): #create sample data + make_sample_data.make_sample_data() + with TemporaryDirectory() as tmp: + chdir(Path(tmp)) + input_path = "archive/am5/am5/am5f3b1r0/c96L65_am5f3b1r0_pdclim1850F/gfdl.ncrc5-deploy-prod-openmp/pp" + output_path = "test" + try: + json, csv = gen_intake_gfdl.create_catalog(input_path,output_path) + except: + sys.exit("Exception occured calling gen_intake_gfdl.create_catalog") + create_data_catalog(path) + json, csv = Path(f"{output}.json").resolve(), Path(f"{output}.csv").resolve() + + try: + assert not None in [csv,json]