gt4sd.tests.utils module

Utilities used in the tests.

Summary

Classes:

GT4SDTestSettings

Utility variables for the tests setup.

Functions:

exitclose_file_creator

Creates an absolute filepath that is closed at exit time.

Reference

class GT4SDTestSettings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_implicit_flags=None, _secrets_dir=None, **values)[source]

Bases: BaseSettings

Utility variables for the tests setup.

gt4sd_s3_host: str
gt4sd_s3_access_key: str
gt4sd_s3_secret_key: str
gt4sd_s3_secure: bool
gt4sd_ci: bool
model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': False, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_hide_none_type': False, 'cli_implicit_flags': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_settings_source': None, 'cli_use_class_docs_for_groups': False, 'env_file': None, 'env_file_encoding': None, 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'forbid', 'frozen': True, 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_', 'settings_'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_file': None, 'yaml_file_encoding': None}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

static get_instance()[source]
Return type

GT4SDTestSettings

__dict__
__pydantic_fields_set__: set[str]

The names of fields explicitly set during instantiation.

__pydantic_extra__: dict[str, Any] | None

A dictionary containing extra values, if [extra][pydantic.config.ConfigDict.extra] is set to ‘allow’.

__pydantic_private__: dict[str, Any] | None

Values of private attributes set on the model instance.

__abstractmethods__ = frozenset({})
__annotations__ = {'__class_vars__': 'ClassVar[set[str]]', '__private_attributes__': 'ClassVar[Dict[str, ModelPrivateAttr]]', '__pydantic_complete__': 'ClassVar[bool]', '__pydantic_core_schema__': 'ClassVar[CoreSchema]', '__pydantic_custom_init__': 'ClassVar[bool]', '__pydantic_decorators__': 'ClassVar[_decorators.DecoratorInfos]', '__pydantic_extra__': 'dict[str, Any] | None', '__pydantic_fields_set__': 'set[str]', '__pydantic_generic_metadata__': 'ClassVar[_generics.PydanticGenericMetadata]', '__pydantic_parent_namespace__': 'ClassVar[Dict[str, Any] | None]', '__pydantic_post_init__': "ClassVar[None | Literal['model_post_init']]", '__pydantic_private__': 'dict[str, Any] | None', '__pydantic_root_model__': 'ClassVar[bool]', '__pydantic_serializer__': 'ClassVar[SchemaSerializer]', '__pydantic_validator__': 'ClassVar[SchemaValidator | PluggableSchemaValidator]', '__signature__': 'ClassVar[Signature]', 'gt4sd_ci': <class 'bool'>, 'gt4sd_s3_access_key': <class 'str'>, 'gt4sd_s3_host': <class 'str'>, 'gt4sd_s3_secret_key': <class 'str'>, 'gt4sd_s3_secure': <class 'bool'>, 'model_computed_fields': 'ClassVar[Dict[str, ComputedFieldInfo]]', 'model_config': 'ClassVar[SettingsConfigDict]', 'model_fields': 'ClassVar[Dict[str, FieldInfo]]'}
__class_vars__: ClassVar[set[str]] = {}

The names of the class variables defined on the model.

__doc__ = 'Utility variables for the tests setup.'
__hash__() int

Return hash(self).

Return type

int

__module__ = 'gt4sd.tests.utils'
__private_attributes__: ClassVar[Dict[str, ModelPrivateAttr]] = {}

Metadata about the private attributes of the model.

__pydantic_complete__: ClassVar[bool] = True

Whether model building is completed, or if there are still undefined fields.

__pydantic_core_schema__: ClassVar[CoreSchema] = {'cls': <class 'gt4sd.tests.utils.GT4SDTestSettings'>, 'config': {'extra_fields_behavior': 'forbid', 'title': 'GT4SDTestSettings', 'validate_default': True}, 'custom_init': True, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.tests.utils.GT4SDTestSettings'>, title=None), <bound method BaseModel.__get_pydantic_json_schema__ of <class 'gt4sd.tests.utils.GT4SDTestSettings'>>]}, 'ref': 'gt4sd.tests.utils.GT4SDTestSettings:94662760952224', 'root_model': False, 'schema': {'computed_fields': [], 'fields': {'gt4sd_ci': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': False, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_access_key': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': 'a19f93a1c67949f1a31db38e58bcb7e8', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_host': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': 's3.mil01.cloud-object-storage.appdomain.cloud', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secret_key': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': '5748375c761a4f09c30a68cd15e218e3b27ca3e2aebd7726', 'schema': {'type': 'str'}, 'type': 'default'}, 'type': 'model-field'}, 'gt4sd_s3_secure': {'metadata': {'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>], 'pydantic_js_functions': []}, 'schema': {'default': True, 'schema': {'type': 'bool'}, 'type': 'default'}, 'type': 'model-field'}}, 'model_name': 'GT4SDTestSettings', 'type': 'model-fields'}, 'type': 'model'}

The core schema of the model.

__pydantic_custom_init__: ClassVar[bool] = True

Whether the model has a custom __init__ method.

__pydantic_decorators__: ClassVar[_decorators.DecoratorInfos] = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})

Metadata containing the decorators defined on the model. This replaces Model.__validators__ and Model.__root_validators__ from Pydantic V1.

__pydantic_generic_metadata__: ClassVar[_generics.PydanticGenericMetadata] = {'args': (), 'origin': None, 'parameters': ()}

Metadata for generic models; contains data used for a similar purpose to __args__, __origin__, __parameters__ in typing-module generics. May eventually be replaced by these.

__pydantic_parent_namespace__: ClassVar[Dict[str, Any] | None] = None

Parent namespace of the model, used for automatic rebuilding of models.

__pydantic_post_init__: ClassVar[None | Literal['model_post_init']] = None

The name of the post-init method for the model, if defined.

__pydantic_serializer__: ClassVar[SchemaSerializer] = SchemaSerializer(serializer=Model(     ModelSerializer {         class: Py(             0x00005618643d71a0,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "gt4sd_s3_secure": SerField {                         key_py: Py(                             0x00007f1ea60e7d70,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x000056185a4635a0,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "gt4sd_s3_access_key": SerField {                         key_py: Py(                             0x00007f1ea60f0f80,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ddead0f90,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "gt4sd_s3_secret_key": SerField {                         key_py: Py(                             0x00007f1ea60f0fd0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1de6fe15a0,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "gt4sd_s3_host": SerField {                         key_py: Py(                             0x00007f1ea60e7d30,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ddead0f30,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "gt4sd_ci": SerField {                         key_py: Py(                             0x00007f1ddeac5db0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x000056185a463580,                                         ),                                     ),                                     serializer: Bool(                                         BoolSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 5,             },         ),         has_extra: false,         root_model: false,         name: "GT4SDTestSettings",     }, ), definitions=[])

The pydantic-core SchemaSerializer used to dump instances of the model.

__pydantic_validator__: ClassVar[SchemaValidator | PluggableSchemaValidator] = SchemaValidator(title="GT4SDTestSettings", validator=Model(     ModelValidator {         revalidate: Never,         validator: ModelFields(             ModelFieldsValidator {                 fields: [                     Field {                         name: "gt4sd_s3_host",                         lookup_key: Simple {                             key: "gt4sd_s3_host",                             py_key: Py(                                 0x00007f1dde9ff5b0,                             ),                             path: LookupPath(                                 [                                     S(                                         "gt4sd_s3_host",                                         Py(                                             0x00007f1dde81d5b0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f1ea60e7d30,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ddead0f30,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: true,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "gt4sd_s3_access_key",                         lookup_key: Simple {                             key: "gt4sd_s3_access_key",                             py_key: Py(                                 0x00007f1ddeae2c90,                             ),                             path: LookupPath(                                 [                                     S(                                         "gt4sd_s3_access_key",                                         Py(                                             0x00007f1ddeae2ce0,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f1ea60f0f80,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ddead0f90,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: true,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "gt4sd_s3_secret_key",                         lookup_key: Simple {                             key: "gt4sd_s3_secret_key",                             py_key: Py(                                 0x00007f1ddeae2c40,                             ),                             path: LookupPath(                                 [                                     S(                                         "gt4sd_s3_secret_key",                                         Py(                                             0x00007f1ddeae2d30,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f1ea60f0fd0,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1de6fe15a0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: true,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "gt4sd_s3_secure",                         lookup_key: Simple {                             key: "gt4sd_s3_secure",                             py_key: Py(                                 0x00007f1dde81d570,                             ),                             path: LookupPath(                                 [                                     S(                                         "gt4sd_s3_secure",                                         Py(                                             0x00007f1dde81d530,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f1ea60e7d70,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x000056185a4635a0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Bool(                                     BoolValidator {                                         strict: false,                                     },                                 ),                                 validate_default: true,                                 copy_default: false,                                 name: "default[bool]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         name: "gt4sd_ci",                         lookup_key: Simple {                             key: "gt4sd_ci",                             py_key: Py(                                 0x00007f1dde81d5f0,                             ),                             path: LookupPath(                                 [                                     S(                                         "gt4sd_ci",                                         Py(                                             0x00007f1dde81d630,                                         ),                                     ),                                 ],                             ),                         },                         name_py: Py(                             0x00007f1ddeac5db0,                         ),                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x000056185a463580,                                     ),                                 ),                                 on_error: Raise,                                 validator: Bool(                                     BoolValidator {                                         strict: false,                                     },                                 ),                                 validate_default: true,                                 copy_default: false,                                 name: "default[bool]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                 ],                 model_name: "GT4SDTestSettings",                 extra_behavior: Forbid,                 extras_validator: None,                 strict: false,                 from_attributes: false,                 loc_by_alias: true,             },         ),         class: Py(             0x00005618643d71a0,         ),         post_init: None,         frozen: false,         custom_init: true,         root_model: false,         undefined: Py(             0x00007f1ea71db950,         ),         name: "GT4SDTestSettings",     }, ), definitions=[], cache_strings=True)

The pydantic-core SchemaValidator used to validate instances of the model.

__signature__: ClassVar[Signature] = <Signature (_case_sensitive: 'bool | None' = None, _nested_model_default_partial_update: 'bool | None' = None, _env_prefix: 'str | None' = None, _env_file: 'DotenvType | None' = PosixPath('.'), _env_file_encoding: 'str | None' = None, _env_ignore_empty: 'bool | None' = None, _env_nested_delimiter: 'str | None' = None, _env_parse_none_str: 'str | None' = None, _env_parse_enums: 'bool | None' = None, _cli_prog_name: 'str | None' = None, _cli_parse_args: 'bool | list[str] | tuple[str, ...] | None' = None, _cli_settings_source: 'CliSettingsSource[Any] | None' = None, _cli_parse_none_str: 'str | None' = None, _cli_hide_none_type: 'bool | None' = None, _cli_avoid_json: 'bool | None' = None, _cli_enforce_required: 'bool | None' = None, _cli_use_class_docs_for_groups: 'bool | None' = None, _cli_exit_on_error: 'bool | None' = None, _cli_prefix: 'str | None' = None, _cli_implicit_flags: 'bool | None' = None, _secrets_dir: 'PathType | None' = None, *, gt4sd_s3_host: str = 's3.mil01.cloud-object-storage.appdomain.cloud', gt4sd_s3_access_key: str = 'a19f93a1c67949f1a31db38e58bcb7e8', gt4sd_s3_secret_key: str = '5748375c761a4f09c30a68cd15e218e3b27ca3e2aebd7726', gt4sd_s3_secure: bool = True, gt4sd_ci: bool = False) -> None>

The synthesized __init__ [Signature][inspect.Signature] of the model.

_abc_impl = <_abc._abc_data object>
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_fields: ClassVar[Dict[str, FieldInfo]] = {'gt4sd_ci': FieldInfo(annotation=bool, required=False, default=False), 'gt4sd_s3_access_key': FieldInfo(annotation=str, required=False, default='a19f93a1c67949f1a31db38e58bcb7e8'), 'gt4sd_s3_host': FieldInfo(annotation=str, required=False, default='s3.mil01.cloud-object-storage.appdomain.cloud'), 'gt4sd_s3_secret_key': FieldInfo(annotation=str, required=False, default='5748375c761a4f09c30a68cd15e218e3b27ca3e2aebd7726'), 'gt4sd_s3_secure': FieldInfo(annotation=bool, required=False, default=True)}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

exitclose_file_creator(file_path)[source]

Creates an absolute filepath that is closed at exit time.

Parameters

file_path (str) – A relative path to a file for which the context handler is created.

Returns

An absolute filepath.

Return type

PosixPath