To help sharing modules easily, we've set few rules, for example py/utils should not import things except python standard modules and py/utils itself.
However, that makes few primitive calls like system, mount, ... etc duplicated when we need to do same thing on DUT (using device API).
Currently we have few APIs in py/utils solving this by allowing a DUT arg, that if the arg is None then the API will try to use DUT API. However, this makes the logic in py/utils diverge and sometimes hard to maintain.
I wonder if there's some better way to simplify this, for example
with dut as d:
utils.DoSomething() # will use d implicitly
utils.DoSomething # will run locally
This is possible if we do some hack to the context stack, but maybe also making things more complicated.
Or, maybe we can change those utils into objects and return the remote execution command in __repr__.
Or, ... whatever.
This is an open issue and low priority. Feel free to re-assign, or think about any solution if you're available.
Comment 1 by hungte@chromium.org
, Jul 26 2017