labgrid
labgrid copied to clipboard
Selecting the target in pytest
The pytest code for selecting a target currently looks like this (fixtures.py):
@pytest.fixture(scope="session")
def target(env):
"""Return the default target `main` configured in the supplied
configuration file."""
target = env.get_target()
if target is None:
raise UserError("Using target fixture without 'main' target in config")
return target
This works well with a single place, called 'main'. But when there are multiple places, we need a way to select the correct one.
I propose adding a --lg-target
option to fixtures.py so that this can be specified.
Then my script to check a particular commit (use with 'git bisect run') can be something like this:
pytest --lg-env env_rpi_try.cfg
--lg-target ${board}
--lg-log --lg-colored-steps
-k test_uboot_smoke
Does this seems reasonable?