Command-Line Flags

Every command-line flag an OpenHTF test script accepts — -v verbosity, --config-file, --config-value, --config-help — and the dashboard_server flags, with how to combine them with your own argparse.

Last updated · Verified with OpenHTF 1.6.1

An OpenHTF test is a plain Python script, but the framework registers a few flags that any script accepts once test.configure() or test.execute() has run.

Terminal
python main.py -vv --config-file station_a.yaml --config-value station_id=EOL-01

Flags every test accepts

-v, -vv, -vvv

Console log verbosity. No flag: framework logs only. -v: info and above from phases and plugs. -vv: debug and above. See Logger.

--config-file FILE

Load configuration from a YAML or JSON file. Equivalent to CONF.load_from_file(). Values from the file override declared defaults.

--config-value KEY=VALUE

Set one configuration key. Repeatable. Overrides both defaults and the file. The value is always a string — cast in code if you need an int.

--config-help

Print every declared configuration key with its description and default, then exit. Run it on your own test to document its knobs.

-h, --help

Standard argparse help, including the flags above.

Flags are parsed with parse_known_args(), so unknown flags are left alone for your own parser.

Combining with your own arguments

OpenHTF exposes its parsers as ARG_PARSER objects you can pass as parents:

main.py
import argparse
import openhtf as htf
from openhtf.util import configuration, logs

def main():
    parser = argparse.ArgumentParser(
        parents=[configuration.ARG_PARSER, logs.ARG_PARSER],
        description="PCB01 end-of-line test",
    )
    parser.add_argument("--fixture", choices=["A", "B"], default="A")
    args = parser.parse_args()          # -v and --config-* still work

    test = htf.Test(*phases_for(args.fixture))
    test.execute(lambda: "SN1234")

if __name__ == "__main__":
    main()

dashboard_server flags

The multi-station dashboard is a separate entry point:

Terminal
python -m openhtf.output.servers.dashboard_server --dashboard-server-port 12000 --no-launch-web-gui
--dashboard-server-port PORT
Port to serve the dashboard on. Default 12000.
--discovery-interval-s N
Seconds between multicast discovery rounds. Default 1.
--launch-web-gui / --no-launch-web-gui
Open the browser automatically (default on).
--no-local-only
Also list stations discovered on other hosts, not just this machine.
--station-discovery-address / --station-discovery-port / --station-discovery-ttl
Multicast group settings; defaults 239.1.1.1, 10000, TTL 1. Must match the station_discovery_* configuration keys on the stations.

Environment variables

OpenHTF itself reads none. TofuPilot's upload() callback reads TOFUPILOT_API_KEY (see Manufacturing Test Analytics). A common pattern is to gate optional phases on an environment variable with run_if — see Run if.

On this page

First-pass yield
0%4.1
Track with TofuPilot