Skip to content

Commit a699f1d

Browse files
committed
tests/test_agent.py: parametrize test_all_modules
Use pytest.mark.parametrize to avoid code duplication in test_all_modules. This will also allow us to see if only one module is failing or if all modules are failing which could be helpful for debugging. Signed-off-by: David Lechner <dlechner@baylibre.com>
1 parent 93fa254 commit a699f1d

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

tests/test_agent.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,20 +96,18 @@ def test_local():
9696
dummy = aw.load('dummy')
9797
assert dummy.neg(1) == -1
9898

99-
def test_all_modules():
99+
@pytest.mark.parametrize('module_name', [
100+
'deditec_relais8',
101+
'sysfsgpio',
102+
'usb_hid_relay'
103+
])
104+
def test_all_modules(module_name: str) -> None:
100105
aw = AgentWrapper(None)
101-
aw.load('deditec_relais8')
102-
methods = aw.list()
103-
assert 'deditec_relais8.set' in methods
104-
assert 'deditec_relais8.get' in methods
105-
aw.load('sysfsgpio')
106-
methods = aw.list()
107-
assert 'sysfsgpio.set' in methods
108-
assert 'sysfsgpio.get' in methods
109-
aw.load('usb_hid_relay')
106+
107+
aw.load(module_name)
110108
methods = aw.list()
111-
assert 'usb_hid_relay.set' in methods
112-
assert 'usb_hid_relay.get' in methods
109+
assert f'{module_name}.set' in methods
110+
assert f'{module_name}.get' in methods
113111

114112
def test_import_modules():
115113
import labgrid.util.agents

0 commit comments

Comments
 (0)