diff --git a/test/test_scripts_and_data/compare_dbs.py b/test/test_scripts_and_data/compare_dbs.py index 9714f44..39f7f91 100644 --- a/test/test_scripts_and_data/compare_dbs.py +++ b/test/test_scripts_and_data/compare_dbs.py @@ -2,6 +2,11 @@ import numpy as np import json + +# TODO: more sophisticated checks for these keys +KEYS_TO_SKIP = ["parameter-values"] + + def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_fractional_tolerance: float = 0.01): """ Compare a montydb generated by tests in the KDP to a reference json file. @@ -30,7 +35,7 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f # VC comments may be a string with float numbers embedded, too much hassle to test continue if isinstance(reference_result[key],dict): - if "source-value" in reference_result[key]: + if ("source-value" in reference_result[key]) and (key not in KEYS_TO_SKIP): # ok, this is a property key, search for this result # generic error message error_message_specifying_pair_and_key = "\n\nTest failed while comparing to key '%s' in instance-id %d in reference runner-subject pair %s:\n" \ @@ -39,8 +44,6 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f # get numpy array of the source-value from the reference db reference_source_value_array = np.asarray(reference_result[key]["source-value"]) - - """ MONTYDB VERSION NOTE: In 2.1.1, the version in the KDP, querying the /pipeline/db like this gives and requires dicts @@ -54,8 +57,7 @@ def compare_db_to_reference(reference_json_path: str, test_db_path: str, float_f "meta.uuid":{"$regex":reference_runner_and_subject}, "instance-id.$numberInt":str(reference_instance_id) } - project={key:1,"_id":False} - cursor=db.data.find(query,projection=project) + cursor=db.data.find(query) # get numpy array of the source-value from the DB we are testing try: