Files
galaxy/test/unit/tool_util/test_hash_function_names_sync.py
T
John ChiltonandClaude Opus 4.7 aef25d3cb0 Add strict Pydantic Job model for TestJob.job
Follow-up to #18884 which modeled TestJob.outputs but left TestJob.job
as Dict[str, Any]. Schema defines the canonical CWL-style workflow-test
input syntax; legacy type: File|Directory|raw forms stay in populator
helpers and are no longer accepted in fixtures.

- New galaxy.tool_util_models.test_job with Job = RootModel[dict[str, ...]]
  - File variants (LocationFile, PathFile, ContentsFile, CompositeDataFile)
    dispatched via callable Discriminator on dict-shape
  - Collection with recursive CollectionElement, strict collection_type
  - Directory (supported by galactic_job_json; IWC unused but in-tree
    bwa_mem2_index fixture needs it)
  - HashEntry using galaxy.util.hash_util.HashFunctionNames
  - Non-recursive list axis (List[File|scalar]) — no observed deeper nesting
- Moved StrictModel + CollectionType + _check_collection_type to _base.py
  so test_job.py can reuse them without circular import.
- TestJob.job: Dict[str, Any] -> Job; Job re-exported at package top.
- test_test_format_model.py: 12 positive + 7 negative parametrized unit
  fixtures covering every union arm and the canonical rejection cases.
- replacement_parameters_legacy.gxwf-tests.yml parked on skip list with
  explanation — replacement_parameters: {...} is Planemo-era magic popped
  by run_workflow, not a canonical job input.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 09:53:59 -04:00

15 lines
595 B
Python

"""Guard that the mirrored HashFunctionNames in tool_util_models stays in sync
with galaxy.util.hash_util. The mirror exists so the package has no runtime
dep on galaxy.util; this test lives here (not in test/unit/tool_util_models/)
so it runs in the monorepo env where galaxy.util is importable.
"""
from typing import get_args
from galaxy.tool_util_models.test_job import HashFunctionNames as MirroredHashFunctionNames
from galaxy.util.hash_util import HashFunctionNames
def test_hash_function_names_in_sync():
assert get_args(MirroredHashFunctionNames) == get_args(HashFunctionNames)