reprospect.test.environment module

class reprospect.test.environment.EnvironmentField(env: str | None = None, converter: Callable[[str], T] | None = None, default: T | None = None)View on GitHub

Bases: Generic[T]

Descriptor that returns a value lazily read from an environment variable.

Based on:

__init__(env: str | None = None, converter: Callable[[str], T] | None = None, default: T | None = None) None
converter: Callable[[str], T] | None

Callable to convert the value of the environment variable to the target type.

default: T | None

Default value if the environment variable does not exist.

env: str | None

Name of the environment variable.

read(instance, owner) TView on GitHub

Read from the environment.

reset() NoneView on GitHub

Reset, thus forcing a re-read from environment on next access.

class reprospect.test.environment.T

Type variable for EnvironmentField and related generics.

alias of TypeVar(‘T’)