Skip to content

Commit

Permalink
[BUGFIX] check contrib requirements (#4922)
Browse files Browse the repository at this point in the history
* Add check that requirements is a list, but don't crash if it's not

* Make requirements for icd_ten_category expectation a list
  • Loading branch information
kenwade4 committed Apr 21, 2022
1 parent 404b979 commit fa64f1a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions assets/scripts/build_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def get_contrib_requirements(filepath: str) -> Dict:
if "library_metadata" in target_ids:
library_metadata = ast.literal_eval(node.value)
requirements = library_metadata.get("requirements", [])
if type(requirements) == str:
requirements = [requirements]
requirements_info[current_class] = requirements
requirements_info["requirements"] += requirements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def validate_configuration(
"contributors": [
"@andyjessen",
],
"requirements": "simple_icd_10",
"requirements": ["simple_icd_10"],
}


Expand Down
2 changes: 2 additions & 0 deletions great_expectations/expectations/expectation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,8 @@ def _get_augmented_library_metadata(self):
)
if forbidden_keys:
problems.append(f"Extra key(s) found: {sorted(forbidden_keys)}")
if type(augmented_library_metadata["requirements"]) != list:
problems.append("library_metadata['requirements'] is not a list ")
if not problems:
augmented_library_metadata["library_metadata_passed_checks"] = True
else:
Expand Down

0 comments on commit fa64f1a

Please sign in to comment.