Files
galaxy/test/unit/tool_util/test_test_format_model.py
T
John Chilton f91012244b New packages galaxy-tool-util-models, galaxy-tool-shed-schema.
The galaxy-tool-shed-schema package is basically pydantic models for the whole tool shed API. It is used by both the backend code for the new tool shed and the testing code that runs on both the old and new tool shed.

The creation of galaxy-tool-util-models package is something I've wanted to do for a while - it should solve some TODOs I've left in the base. I think beyond enabling galaxy-tool-shed-schema package - the other nice thing is that galaxy-schema code can now rely on various tool stuff without requiring dependency on any of the parser or runtime code.

This should also fix things for the new record types in #19377. I've introduced a type that can be used tools and is included schema for collection creation. The galaxy-tool-util-models packages can now be dependended on by galaxy-schema and galaxy-tool-util and these two packages do not need to depend on each other - either direction of that dependency would make me uncomfortable. xref
https://github.com/galaxyproject/galaxy/actions/runs/13704893929/job/38327692654?pr=19377
2025-04-16 12:47:37 +02:00

40 lines
1.2 KiB
Python

import os
from pathlib import Path
from typing import List
import yaml
from galaxy.tool_util_models import Tests
from galaxy.util import galaxy_directory
from galaxy.util.unittest_utils import skip_unless_environ
TEST_WORKFLOW_DIRECTORY = os.path.join(galaxy_directory(), "lib", "galaxy_test", "workflow")
IWC_WORKFLOWS_USING_UNVERIFIED_SYNTAX: List[str] = []
def test_validate_workflow_tests():
path = Path(TEST_WORKFLOW_DIRECTORY)
test_files = path.glob("*.gxwf-tests.yml")
for test_file in test_files:
with open(test_file) as f:
json = yaml.safe_load(f)
Tests.model_validate(json)
@skip_unless_environ("GALAXY_TEST_IWC_DIRECTORY")
def test_iwc_directory():
path = Path(os.environ["GALAXY_TEST_IWC_DIRECTORY"])
test_files = path.glob("workflows/**/*-test*.yml")
for test_file in test_files:
print(test_file)
skip_file = False
for unverified in IWC_WORKFLOWS_USING_UNVERIFIED_SYNTAX:
if str(test_file).endswith(unverified):
skip_file = True
if skip_file:
continue
with open(test_file) as f:
json = yaml.safe_load(f)
Tests.model_validate(json)