Coverage for tests/cli_schema_doubles.py: 92%

13 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-09-09 09:53 +0000

1# This file is part of lsst-images. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

9# Use of this source code is governed by a 3-clause BSD-style 

10# license that can be found in the LICENSE file. 

11"""A development schema that exists only to exercise the fixtures CLI. 

12 

13``fixtures refresh`` acts only on schemas still in development, and every 

14schema is finalized during a release, so a test that named a real one would 

15stop exercising the path it claims. This double is never finalized. 

16 

17It is defined in the test tree, so ``available_schema_classes`` never returns 

18it for ``lsst.images``: it is never frozen, published, or part of shipped 

19data. Tests reach it by passing this module as the CLI's ``--package``, which 

20selects this schema and no other. 

21 

22This is a plain module rather than a test module so importing it registers the 

23schema deterministically, independent of pytest's collection order. 

24""" 

25 

26from __future__ import annotations 

27 

28__all__ = ("CliFixtureDouble",) 

29 

30from typing import Any, ClassVar 

31 

32import pydantic 

33 

34from lsst.images.serialization import ArchiveTree, InputArchive 

35 

36 

37class CliFixtureDouble(ArchiveTree): 

38 """Development schema whose fixture the CLI tests write by hand.""" 

39 

40 SCHEMA_NAME: ClassVar[str] = "cli_fixture_double" 

41 SCHEMA_VERSION: ClassVar[str] = "1.0.0.dev0" 

42 MIN_READ_VERSION: ClassVar[int] = 1 

43 PUBLIC_TYPE: ClassVar[type] = dict 

44 

45 value: str = pydantic.Field(description="Arbitrary content; required, so an empty tree fails to read.") 

46 

47 def deserialize(self, archive: InputArchive[Any], **kwargs: Any) -> Any: 

48 return {"value": self.value}