nanaimo icon indicating copy to clipboard operation
nanaimo copied to clipboard

Support pytest test parametrization via nanaimo.cfg

Open kcandow opened this issue 4 years ago • 0 comments

Parametrizing Pytest tests and fixtures makes testing different setups and configuration more natural. The pytest concept of parametrizing translates well to the nanaimo concept of testing different hardware configurations on a single test rig.

Assume that a test rig may have any number of widgets that all respond to the foo test. A parametrized test would look like this:

@pytest.mark.asyncio
@pytest.mark.parametrize("widget_id", ["w0", "w1", "w2"])
async def test_foo(foo_fixture):
    assert_success(await foo_fixture.gather(dut=widget_id))

Ideally, the list of widgets (w0, w1, w2) would live in /etc/nanaimo.cfg, not in the test file.

Right now, /etc/nanaimo.cfg is used to specify the default arguments for fixtures, but the outputs of a fixture cannot be used to parametrize a test or a fixture, [2].

This issue is for a feature that allows pytest parametrization via /etc/nanaimo.cfg (or another fixed, test rig-specific file).

kcandow avatar Apr 06 '20 20:04 kcandow