Skip to content

hertzforge.core.test_setup

test_setup

A test's setup, held in a project: what one control module is configured with, saved so it can be opened again.

The control service is configured by one request per test module (random.configure, sine.configure, mimo_random.setup, ...), whose configuration is the whole setup: the profile or target, the schedule, the limits, the control settings and the operator's words. A TestSetup keeps that configuration exactly as the service accepts it, with the module it is for, the protocol it was written under, the channel table it was made with, a title and notes, and where it came from. It is saved in the project file as the test_setup kind (docs/hforge-format.md).

A run's record holds the same configuration (RunRecord.config), so a setup is made from a run with TestSetup.from_run, and opening a setup from a run and opening a saved one are the same act.

Opening a setup never configures anything here. The shell fills a test's draft with it, and the draft goes through the same configure call and the same checks as one typed in.

Classes:

Name Description
TestSetup

One test module's setup, as the control service accepts it.

Functions:

Name Description
origin

An origin, checked: kind and what that kind names.

Classes

TestSetup

TestSetup(module: str, config: Mapping[str, Any], protocol: str = PROTOCOL, table: Mapping[str, Any] | None = None, title: str = '', notes: str = '', origin: Mapping[str, Any] | None = None)

One test module's setup, as the control service accepts it.

Parameters:

Name Type Description Default
module str

The test module it is for, one of MODULES.

required
config mapping

The configuration exactly as the module's configure request takes it (CONFIGURE), parsed from JSON. It is kept whole: a member this build knows nothing of is carried, not dropped.

required
protocol str

The protocol it was written under ('sds/1').

PROTOCOL
table mapping

The channel table it was made with: rows in the control service's spelling, its revision, and its sha256 when the service gave one. Empty when it was not recorded.

None
title str

What the setup is called in words.

''
notes str

The operator's notes on it.

''
origin mapping

Where it came from (origin); typed when not given.

None

Methods:

Name Description
from_run

The setup a run ran with, from its record (RunRecord).

as_dict

The setup as the analysis service carries it (project.open_setup).

from_dict

A setup from what as_dict gives (or the shell sends).

describe

A few words on the setup: its module and where it came from.

Attributes:

Name Type Description
configure tuple[str, dict[str, Any]]

The configure request this setup would be sent with: its

Attributes
configure property
configure: tuple[str, dict[str, Any]]

The configure request this setup would be sent with: its method and params. Opening a setup never sends it; this is what the shell's draft sends once the operator applies it.

Methods:
from_run classmethod
from_run(record: Any, name: str | None = None) -> TestSetup

The setup a run ran with, from its record (RunRecord).

Parameters:

Name Type Description Default
record RunRecord

The run's record; its setup.config is the configuration as the service accepted it.

required
name str

The record's name in the project, kept in the origin.

None

Returns:

Type Description
TestSetup

Its configuration, the table the run armed with, the run's title and notes, and the run as its origin.

Raises:

Type Description
ValueError

When the record names no test this build has a setup for, or holds no configuration.

as_dict
as_dict() -> dict[str, Any]

The setup as the analysis service carries it (project.open_setup).

from_dict classmethod
from_dict(held: Mapping[str, Any]) -> TestSetup

A setup from what as_dict gives (or the shell sends).

describe
describe() -> str

A few words on the setup: its module and where it came from.

Returns:

Type Description
str

Such as 'random setup, from run r-0003'.

Functions:

origin

origin(kind: str = 'typed', **members: Any) -> dict[str, Any]

An origin, checked: kind and what that kind names.

Parameters:

Name Type Description Default
kind str

One of ORIGIN_KINDS.

'typed'
**members Any

For 'setup', name (the saved setup's name). For 'run', run_uid and/or run_id, and name (the run record's name in the project) when there is one. For 'seed', object (the analysis object's name), checksum (its SHA-256, hex) and fills (what part of the setup it filled), which a seed's builder sets.

{}

Returns:

Type Description
dict

The origin, with members that are None left out.

Raises:

Type Description
ValueError

For an unknown kind or a missing member.