From d20e5e976f70bd2e230787091a88278dfe6e5192 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 26 Jan 2016 15:26:04 -0700 Subject: test/py: Provide custom IDs when parametrizing tests When pytest generates the name for parametrized tests, simple parameter values (ints, strings) get used directly, but more complex values such as dicts are not handled. This yields test names such as: dfu[env__usb_dev_port0-env__dfu_config0] dfu[env__usb_dev_port0-env__dfu_config1] Add some code to extract a custom fixture ID from the fixture values, so that we end up with meaningful names such as: dfu[micro_b-emmc] dfu[devport2-ram] If the boardenv file doesn't define custom names, the code falls back to the old algorithm. Signed-off-by: Stephen Warren Reviewed-by: Simon Glass --- test/py/tests/test_dfu.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/py/tests/test_dfu.py') diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py index c09b902..bb70008 100644 --- a/test/py/tests/test_dfu.py +++ b/test/py/tests/test_dfu.py @@ -21,6 +21,7 @@ For example: env__usb_dev_ports = ( { + "fixture_id": "micro_b", "tgt_usb_ctlr": "0", "host_usb_dev_node": "/dev/usbdev-p2371-2180", # This parameter is optional /if/ you only have a single board @@ -32,10 +33,12 @@ env__usb_dev_ports = ( env__dfu_configs = ( # eMMC, partition 1 { + "fixture_id": "emmc", "alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1", "cmd_params": "mmc 0", }, ) + b) udev rules to set permissions on devices nodes, so that sudo is not required. For example: -- cgit v1.1