Skip to content

Commit

Permalink
Fix test reports not being written
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Aug 1, 2024
1 parent 242a321 commit b5a2951
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ogc/bblocks/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _validate_resource(bblock: BuildingBlock,
base_uri=base_uri,
additional_shacl_closures=additional_shacl_closures,
schema_ref=schema_ref)
any_validator_run = any_validator_run or (result is not None)
any_validator_run = any_validator_run or (result is not False)

except Exception as unknown_exc:
report.add_entry(ValidationReportEntry(
Expand Down
2 changes: 1 addition & 1 deletion ogc/bblocks/validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def validate(self, filename: Path, output_filename: Path,
base_uri: str | None = None,
resource_url: str | None = None,
require_fail: bool | None = None,
**kwargs) -> ValidationReportItem | None:
**kwargs) -> bool | None:
raise NotImplementedError


Expand Down
6 changes: 2 additions & 4 deletions ogc/bblocks/validation/json_.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ def __init__(self, bblock: BuildingBlock, register: BuildingBlockRegister):
def validate(self, filename: Path, output_filename: Path, report: ValidationReportItem,
contents: str | None = None,
schema_ref: str | None = None,
**kwargs) -> ValidationReportItem | None:
**kwargs) -> bool | None:

if filename.suffix not in ('.json', '.jsonld', '.yaml', '.yml'):
return
return False

file_from = 'examples' if report.source.type == ValidationItemSourceType.EXAMPLE else 'test resources'

Expand Down Expand Up @@ -232,5 +232,3 @@ def validate(self, filename: Path, output_filename: Path, report: ValidationRepo
'col': e.colno,
}
))

return report
6 changes: 2 additions & 4 deletions ogc/bblocks/validation/rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ def validate(self, filename: Path, output_filename: Path, report: ValidationRepo
contents: str | None = None,
base_uri: str | None = None,
additional_shacl_closures: list[str | Path] | None = None,
**kwargs) -> ValidationReportItem | None:
**kwargs) -> bool | None:
graph = self._load_graph(filename, output_filename, report, contents, base_uri)

if graph is None:
return
return False

if graph is not None and (contents or filename.suffix != '.ttl'):
try:
Expand Down Expand Up @@ -418,5 +418,3 @@ def validate(self, filename: Path, output_filename: Path, report: ValidationRepo
'shaclFile': str(shacl_file),
}
))

return report

0 comments on commit b5a2951

Please sign in to comment.