Hi,
I have migrated my project to make use of the pyjoulescope_driver from the former example pyjoulescope_examples/bin at main · jetperch/pyjoulescope_examples · GitHub (from Updated dut_power.py to use pyjoulescope_driver directly. · jetperch/pyjoulescope_examples@09148e2 · GitHub)
I would like to not changing my interface of my package. That’s why I have migrated the dut_power.py.
I have written 2 pytest unittests which both fail with:
c:\code\project\
src\dut_power.py:48: in dut_power
with Driver() as jsdrv:
pyjoulescope_driver/binding.pyx:614: in pyjoulescope_driver.binding.Driver.__init__
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E RuntimeError: jsdrv_initialize failed 21 IN_USE | The requested resource is currently in use.
pyjoulescope_driver/binding.pyx:595: RuntimeError
The unit test:
def doPowerDUT(self, value="on"):
if isinstance(value, str):
value = value.lower()
sys.argv.clear()
sys.argv.append("dut_power.py")
if value == "off" or value == 0:
sys.argv.append("0")
dut_power("0") # if does not work take _power_off from trigger.py
return True, "OK", {"doPowerDUT set to {}".format(value)}
elif value == "on" or value == 1:
sys.argv.append("1")
dut_power("1")
self.log.info("DO_POWER_DUT(1)")
return True, "OK", {"do power DUT": str(value)}
else:
self.log.info("DO_POWER_DUT(0)")
return False, "ERROR", {"do power DUT": str(value)}
return True, "OK", {"do power DUT": str(value)}
installed packages:
> python -m pyjoulescope_driver info
SYSTEM INFORMATION
------------------
python 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) [MSC v.1929 64 bit (AMD64)]
python impl CPython
platform Windows-10-10.0.19045-SP0
processor Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
CPU cores 2 physical, 4 total
CPU frequency 2701 MHz (0 MHz min to 2701 MHz max)
RAM 2.9 GB available, 7.9 GB total (36.7%)
PYTHON PACKAGE INFORMATION
--------------------------
jls 0.9.4
joulescope 1.1.9
numpy 1.24.4
pyjoulescope_driver 1.4.10
JOULESCOPE INFORMATION
----------------------
u/js110/xxxxxx
Assumption:
That when using with Driver() as jsdrv:
does close all handles but it doesn’t.