Skip to content

Commit

Permalink
Ignoring fail cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciheim Brown authored and Ciheim Brown committed Jun 4, 2024
1 parent b9e18bc commit 40bc1d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/create-gfdl-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ jobs:
$CONDA/envs/catalogbuilder/bin/pytest -v --runxfail
- name: Test for completeness
run: |
$CONDA/envs/catalogbuilder/bin/python tests/test_catalog.py cats/gfdl_autotest.json
$CONDA/envs/catalogbuilder/bin/python tests/test_catalog.py cats/gfdl_autotest_from_yaml.json
$CONDA/envs/catalogbuilder/bin/python tests/test_catalog.py -tf cats/gfdl_autotest.json
$CONDA/envs/catalogbuilder/bin/python tests/test_catalog.py -tf cats/gfdl_autotest_from_yaml.json
14 changes: 11 additions & 3 deletions tests/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
@click.command()
@click.argument('json_path', nargs = 1 , required = True)
@click.argument('json_template_path', nargs = 1 , required = False)
def main(json_path,json_template_path):
@click.option('-tf', '--test-failure', is_flag=True, default = False, help="Errors are only printed. Program will not exit.")
def main(json_path,json_template_path,test_failure):

#Open JSON
j = json.load(open(json_path))
Expand All @@ -29,7 +30,10 @@ def main(json_path,json_template_path):
catalog = pd.read_csv(csv_path)

if len(catalog.index) < 1:
sys.exit("Catalog has no values")
if test_failure:
print("Catalog has no values")
else:
sys.exit("Catalog has no values")

#Get required columns
req = (j["aggregation_control"]["groupby_attrs"])
Expand All @@ -46,7 +50,11 @@ def main(json_path,json_template_path):
errors += 1

if errors > 0:
sys.exit(f"Found {errors} errors.")
if test_failure:
print(f"Found {errors} errors.")
else:
sys.exit(f"Found {errors} errors.")

if __name__ == '__main__':
main()

0 comments on commit 40bc1d5

Please sign in to comment.