Skip to content

Commit

Permalink
Merge pull request #606 from fractal-analytics-platform/605-use-json-…
Browse files Browse the repository at this point in the history
…schema-instead-of-pydantic-in-test_valid_manifest

Update `test_valid_manifest` (close #605)
  • Loading branch information
tcompa authored Oct 31, 2023
2 parents 16325cd + 81a4540 commit d493c46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Remove `has_args_schema` obsolete property from manifest (\#603).
* Testing:
* Align with new Zenodo API (\#601).
* Update `test_valid_manifest` (\#606).

# 0.13.1

Expand Down
22 changes: 11 additions & 11 deletions tests/test_valid_manifest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import sys
from pathlib import Path

import requests
from devtools import debug
from jsonschema import validate

import fractal_tasks_core

Expand All @@ -13,21 +13,21 @@ def test_valid_manifest(tmp_path):
NOTE: to avoid adding a fractal-server dependency, we simply download the
relevant file.
"""

# Download JSON Schema for ManifestV1
url = (
"https://raw.githubusercontent.com/fractal-analytics-platform/"
"fractal-server/main/fractal_server/app/schemas/manifest.py"
"fractal-server/main/"
"fractal_server/app/schemas/json_schemas/manifest.json"
)
r = requests.get(url)
debug(tmp_path)
with (tmp_path / "fractal_manifest.py").open("wb") as fout:
fout.write(r.content)

sys.path.append(str(tmp_path))
from fractal_manifest import ManifestV1
with (tmp_path / "manifest_schema.json").open("wb") as f:
f.write(r.content)
with (tmp_path / "manifest_schema.json").open("r") as f:
manifest_schema = json.load(f)

module_dir = Path(fractal_tasks_core.__file__).parent
with (module_dir / "__FRACTAL_MANIFEST__.json").open("r") as fin:
manifest_dict = json.load(fin)
manifest = ManifestV1(**manifest_dict)
debug(manifest)

debug(manifest_dict)
validate(instance=manifest_dict, schema=manifest_schema)

0 comments on commit d493c46

Please sign in to comment.