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: |
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 |
required |
config
|
mapping
|
The configuration exactly as the module's configure request
takes it ( |
required |
protocol
|
str
|
The protocol it was written under ('sds/1'). |
PROTOCOL
|
table
|
mapping
|
The channel table it was made with: |
None
|
title
|
str
|
What the setup is called in words. |
''
|
notes
|
str
|
The operator's notes on it. |
''
|
origin
|
mapping
|
Where it came from ( |
None
|
Methods:
| Name | Description |
|---|---|
from_run |
The setup a run ran with, from its record ( |
as_dict |
The setup as the analysis service carries it ( |
from_dict |
A setup from what |
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
¶
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 |
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
¶
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
¶
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
¶
An origin, checked: kind and what that kind names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
One of |
'typed'
|
**members
|
Any
|
For 'setup', |
{}
|
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. |