This is a followup to the recent email thread [1] about pin_dev_irqs
test tool. Since irqs are under /proc directory it makes sense to use
HostAPI.config() method to set it and have LNST set it back when the
recipe finishes. So I decided to implement it in python and I'd like to
use this python code for all python tasks under
recipes/regression_tests/phase{1,2}.
So I placed it in recipes/regression_tests/common/common.py
I thought that I could use relative imports as described in [2] but this
did not work for me due to following error:
ValueError: Attempted relative import in non-package
Based on info I have found on forums I'm almost sure that this simply
can't be done with the current design how we handle python tasks.
Another solution that is possible and working without any support from
LNST is using following code in python tasks:
<cut>
# FILE: recipes/regression_tests/phase1/3_vlans.py
from imp import load_source
load_source("common", '../common/common.py')
from common import pin_dev_irqs
pin_dev_irqs()
</cut>
And the directory structure is following:
recipes/regression_tests/common
./common.py
recipes/regression_tests/phase1
./3_vlans.py
I'd like to get your opinion on this.
-Jan
[1]
https://lists.fedorahosted.org/pipermail/lnst-developers/2015-November/00...
[2]
https://docs.python.org/2/tutorial/modules.html#intra-package-references