-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SCSB-174] move DMS requirement <-> test correlations from `@metrics_…
…logger` decorators to `romancal/tests/dms_requirement_tests.json` (#1399) Co-authored-by: Brett Graham <[email protected]>
- Loading branch information
1 parent
9331d16
commit 9fa24f2
Showing
15 changed files
with
146 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
move DMS requirement <-> test correlations from ``@metrics_logger()`` decorators to ``romancal/tests/dms_requirement_tests.json`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
{ | ||
"DMS9": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_grism_processing_pipeline" | ||
], | ||
"DMS25": [ | ||
"romancal.regtest.test_wfi_dq_init.test_dq_init_grism_step", | ||
"romancal.regtest.test_wfi_dq_init.test_dq_init_image_step" | ||
], | ||
"DMS79": [ | ||
"romancal.regtest.test_wfi_flat_field.test_flat_field_crds_match_image_step" | ||
], | ||
"DMS86": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_image_processing_pipeline" | ||
], | ||
"DMS87": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_image_processing_pipeline" | ||
], | ||
"DMS88": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_image_processing_pipeline" | ||
], | ||
"DMS90": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_grism_processing_pipeline" | ||
], | ||
"DMS91": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_grism_processing_pipeline" | ||
], | ||
"DMS140": [ | ||
"romancal.regtest.test_wfi_photom.test_absolute_photometric_calibration" | ||
], | ||
"DMS278": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_grism_processing_pipeline" | ||
], | ||
"DMS280": [ | ||
"romancal.regtest.test_tweakreg.test_tweakreg", | ||
"romancal.regtest.test_wfi_pipeline.test_level2_image_processing_pipeline" | ||
], | ||
"DMS342": [ | ||
"romancal.regtest.test_resample.test_resample_single_file" | ||
], | ||
"DMS343": [ | ||
"romancal.regtest.test_resample.test_resample_single_file" | ||
], | ||
"DMS344": [ | ||
"romancal.regtest.test_resample.test_resample_single_file" | ||
], | ||
"DMS345": [ | ||
"romancal.regtest.test_resample.test_resample_single_file" | ||
], | ||
"DMS356": [ | ||
"romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" | ||
], | ||
"DMS361": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_image_processing_pipeline" | ||
], | ||
"DMS362": [ | ||
"romancal.regtest.test_ramp_fitting.test_rampfit_step" | ||
], | ||
"DMS363": [ | ||
"romancal.regtest.test_ramp_fitting.test_rampfit_step" | ||
], | ||
"DMS365": [ | ||
"romancal.regtest.test_wfi_pipeline.test_level2_grism_processing_pipeline" | ||
], | ||
"DMS366": [ | ||
"romancal.regtest.test_ramp_fitting.test_rampfit_step" | ||
], | ||
"DMS367": [ | ||
"romancal.regtest.test_ramp_fitting.test_rampfit_step" | ||
], | ||
"DMS373": [ | ||
"romancal.regtest.test_mos_pipeline.test_hlp_mosaic_pipeline" | ||
], | ||
"DMS374": [ | ||
"romancal.regtest.test_catalog.test_catalog_l2", | ||
"romancal.regtest.test_catalog.test_catalog_l3", | ||
"romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" | ||
], | ||
"DMS375": [ | ||
"romancal.regtest.test_catalog.test_catalog_l2", | ||
"romancal.regtest.test_catalog.test_catalog_l3" | ||
], | ||
"DMS376": [ | ||
"romancal.regtest.test_catalog.test_catalog_l2", | ||
"romancal.regtest.test_catalog.test_catalog_l3" | ||
], | ||
"DMS386": [ | ||
"romancal.regtest.test_catalog.test_catalog_l2", | ||
"romancal.regtest.test_catalog.test_catalog_l3" | ||
], | ||
"DMS387": [ | ||
"romancal.regtest.test_catalog.test_catalog_l2", | ||
"romancal.regtest.test_catalog.test_catalog_l3" | ||
], | ||
"DMS400": [ | ||
"romancal.regtest.test_mos_pipeline.test_level3_mos_pipeline" | ||
], | ||
"DMS405": [ | ||
"romancal.regtest.test_tweakreg.test_tweakreg" | ||
], | ||
"DMS413": [ | ||
"romancal.regtest.test_wfi_16resultants.test_16resultants_image_processing" | ||
], | ||
"DMS414": [ | ||
"romancal.regtest.test_wfi_16resultants.test_16resultants_spectral_processing" | ||
], | ||
"DMS488": [ | ||
"romancal.regtest.test_tweakreg.test_tweakreg" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import json | ||
import re | ||
from pathlib import Path | ||
|
||
TEST_DIRECTORY = Path(__file__).parent.parent | ||
TEST_REQUIREMENTS_FILENAME = TEST_DIRECTORY / "tests" / "dms_requirement_tests.json" | ||
|
||
|
||
def test_requirements(): | ||
test_requirements_filename = TEST_REQUIREMENTS_FILENAME.expanduser().absolute() | ||
test_directory = TEST_DIRECTORY.expanduser().absolute() | ||
|
||
with open(test_requirements_filename) as test_requirements_file: | ||
requirements = json.load(test_requirements_file) | ||
|
||
required_tests = { | ||
test | ||
for requirement_tests in requirements.values() | ||
for test in requirement_tests | ||
} | ||
|
||
existing_tests = set() | ||
test_regex = re.compile(r"def (test_[^\(]+)\(.*\):") | ||
for test_filename in test_directory.glob("**/test_*.py"): | ||
with open(test_filename) as test_file: | ||
test_file_contents = test_file.read() | ||
|
||
for match in re.finditer(test_regex, test_file_contents): | ||
test = f"{test_directory.stem}.{str(test_filename.relative_to(test_directory).parent).replace('/', '.')}.{test_filename.stem}.{match.group(1)}" | ||
if test in required_tests: | ||
existing_tests.add(test) | ||
|
||
missing_tests = required_tests - existing_tests | ||
assert ( | ||
not missing_tests | ||
), f"could not find the following tests correlated with DMS requirements: {missing_tests}" |