google / google/openhtf

Access arguments passed to phases from monitors

Open
#833 7 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
722
Forks
237
Avg merge
11h 31m
Merged PRs (30d)
4

Description

I'm trying to access the argument (`node_id`) I provided to my phase from a monitor and here is my code:
```
@htf.plug(mmp=motion_master_plug.MotionMasterPlug)
def speed_monitor(test, mmp, node_id):
return mmp.get_velocity(node_id)

@htf.monitors("velocity", speed_monitor)
@htf.plug(mmp=motion_master_plug.MotionMasterPlug)
def test_velocity_control(test, node_id, mmp):
time.sleep(5)
# Do something here

if __name__ == '__main__':
test = htf.Test(test_velocity_control.with_args(node_id=0))
test.execute(test_start=lambda: "test")
```

But the test execution terminates will the following error:

> Error: __call__() got an unexpected keyword argument 'node_id'

This error only appears if I want to use the monitor and it is completely fine with the phase itself.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.