Skip to content

Fixtures

Loading -p f3ts reports every test automatically — you don't need any of these to get pass/fail results. The fixtures below are opt-in: pull one into a test when you want that test to do more. This is a task-oriented tour; full signatures live in the API Reference.

All of these degrade gracefully offline: with no backend connected, interactions print to the terminal instead of driving the GUI.

test_config — limits & metadata for this test

Returns the config.yml entry whose key matches the test function name (with any [param] suffix stripped), or None if there's no matching entry.

python
def test_5v0_rail(test_config):
    assert test_config.min_limit <= 5.01 <= test_config.max_limit

Fields: test_id, error_code, error_msg, description, min_limit, max_limit, user_vars.

log_vars — record the measured value

Not a fixture but the helper you'll use most. Call log_vars(record_property) inside a test (after assigning a local meas) to record the measurement and the test_config fields to the JUnit XML result log (via record_property):

python
from pytest_f3ts.utils import log_vars


def test_5v0_rail(test_config, record_property):
    meas = 5.01
    log_vars(record_property)
    assert test_config.min_limit <= meas <= test_config.max_limit

f3ts_assert — emit sub-results

A callable that reports each assertion as its own result row (a sub-result under the test's test_id) and then performs the assertion. Useful when one test checks several things:

python
def test_power_rails(interface, f3ts_assert):
    for rail in ("5v0", "3v3", "1v8"):
        meas = interface.measure_rail(rail)
        f3ts_assert(assert_value=(meas > 0), meas=meas, description=f"{rail} present")

Accepts assert_value, meas, min_limit, max_limit, test_id, test_name, description, error_code, error_msg. Missing values fall back to the test's test_config.

user_dialog — prompt the operator

Send a prompt and (optionally) wait for a response. On the Test Runner it's a GUI dialog; offline it goes to the terminal (run pytest with -s so stdin works).

python
from pytest_f3ts import schemas


def test_visual_inspection(user_dialog):
    resp = user_dialog.send(schemas.Dialog(
        title="Visual check",
        message="Is the LED lit?",
        okButtonText="Yes", cancelButtonText="No",
    ))
    assert resp.okClicked

serial_number — capture the DUT serial

python
def test_record_serial(serial_number):
    serial_number.set("WCB-0001")

Offline this just stores the value; on the Test Runner it updates the run record and GUI.

status_banner — override the GUI status banner

python
def test_phase(status_banner):
    status_banner.override(override=True, status="Programming...", color="#f5a623")

Offline this prints the status to the terminal.

fixture_config — per-slot settings

Returns the FixtureSettings for the active --slot_id (slot/serial-number config for multi-up fixtures). Most relevant when running on the Test Runner.

python
def test_uses_slot_var(fixture_config):
    mac = fixture_config.user_vars.get("mac_address")
    assert mac