google / google/openhtf

How can I pass 'conf' variables to a plug?

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

Description

I'm new to python and openhtf and I couldn't find any example on the repo on how to do it. Please help.

```
import openhtf as htf
from openhtf.util import conf

conf.declare(
'hw_io_line',
description='gpio'
)

class HwTestPlug(htf.plugs.BasePlug):
@conf.inject_positional_args
def __init__(self, hw_io_line):
self.hw_io_line = hw_io_line

@htf.plug(htp=HwTestPlug)
def hw_rf_test(test,htp):
print("im here")

if __name__ == '__main__':
test = htf.Test(hw_rf_test)
test.execute(test_start=lambda: 'MyHw')
```

I've tried htf.Test(hw_rf_test).with_args(hw_io_line=23) but I couldn't get to work and I always get this error.

```
Error: __init__() missing 1 required positional argument: 'hw_io_line'
```
It would be great if you can update the examples as this is a great framework.

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.