Skip to content

Commit

Permalink
Merge pull request #1342 from Sage-Bionetworks/develop-fix-fds-1459
Browse files Browse the repository at this point in the history
[bug fix] Remove `great_expectations/expectations/Manifest_test_suite.json` before running validation tests
  • Loading branch information
linglp authored Dec 14, 2023
2 parents 6ac7fe8 + aa7e4c9 commit bddcc39
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion schematic/models/metadata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os
import logging
import string

Expand Down Expand Up @@ -256,7 +257,11 @@ def validateModelManifest(
)

return errors, warnings


# check if suite has been created. If so, delete it
if os.path.exists("great_expectations/expectations/Manifest_test_suite.json"):
os.remove("great_expectations/expectations/Manifest_test_suite.json")

errors, warnings, manifest = validate_all(self,
errors=errors,
warnings=warnings,
Expand Down
12 changes: 8 additions & 4 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def get_rule_combinations():
continue

class TestManifestValidation:
# check if suite has been created. If so, delete it
if os.path.exists("great_expectations/expectations/Manifest_test_suite.json"):
os.remove("great_expectations/expectations/Manifest_test_suite.json")

def test_valid_manifest(self,helpers,metadataModel):
manifestPath = helpers.get_data_path("mock_manifests/Valid_Test_Manifest.csv")
rootNode = 'MockComponent'
Expand Down Expand Up @@ -377,12 +381,11 @@ def test_in_house_validation(self,helpers,sg,metadataModel):
invalid_entry = ['71738', '98085', '210065'],
sg = sg,
)[1] in warnings


@pytest.mark.rule_combos(reason = 'This introduces a great number of tests covering every possible rule combination that are only necessary on occasion.')
@pytest.mark.parametrize("base_rule, second_rule", get_rule_combinations())
def test_rule_combinations(self, helpers, sg, base_rule, second_rule, metadataModel):
#print(base_rule,second_rule)
def test_rule_combinations(self, helpers, sg, base_rule, second_rule, metadataModel,):
rule_regex = re.compile(base_rule+'.*')

manifestPath = helpers.get_data_path("mock_manifests/Rule_Combo_Manifest.csv")
Expand Down Expand Up @@ -429,7 +432,8 @@ def test_rule_combinations(self, helpers, sg, base_rule, second_rule, metadataMo
sg = sg,
jsonSchema = sg.get_json_schema_requirements(rootNode, rootNode + "_validation")
)



#perform validation with no exceptions raised
_, errors, warnings = validateManifest.validate_manifest_rules(
manifest = manifest,
Expand Down

0 comments on commit bddcc39

Please sign in to comment.