lucask07 / covg_fpga

FPGA and Python experiment code for the digital ion channel amplifier project.
GNU General Public License v3.0
6 stars 2 forks source link

DAC80508_ADS8686_test.py executes open_rigol_supply fails during pytest collection #14

Closed lucask07 closed 2 years ago

lucask07 commented 2 years ago

At line 43 of DAC80508_ADS8686_test.py an instrument is opened:

dc_pwr, dc_pwr2 = open_rigol_supply(setup=pwr_setup) # 7V and +/-16.5V, None

This fails during pytest collection on a Mac when not connected to the instrument. python3 -m pytest -m no_fpga

I explored the pytest flag of --continue-on-collection-errors yet this did not remove the error since a Fatal Python error occurs.

Would it be possible to move open_rigol_supply to a fixture/function so that it only happens if the test is run (rather than just collected?)

The terminal error message:

A00080338:python koer2434$ python3 -m pytest --continue-on-collection-errors -m no_fpga ============================================================= test session starts ============================================================== platform darwin -- Python 3.9.7, pytest-7.1.2, pluggy-1.0.0 rootdir: /Users/koer2434/Documents/covg_fpga, configfile: pyproject.toml plugins: anyio-3.5.0 collecting ... Fatal Python error: Aborted Current thread 0x000000011602a600 (most recent call first): File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/pyvisa/ctwrapper/functions.py", line 1871 in open_default_resource_manager File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/pyvisa/highlevel.py", line 3024 in new File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/instrbuilder/scpi.py", line 674 in open_visa File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/instrbuilder/scpi.py", line 651 in init File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/instrbuilder/scpi.py", line 975 in init_instrument File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/instrbuilder/instrument_opening.py", line 273 in open_by_name File "/Users/koer2434/Documents/covg_fpga/python/instruments/power_supply.py", line 10 in open_rigol_supply File "/Users/koer2434/Documents/covg_fpga/python/tests/integration_tests/DAC80508_ADS8686_test.py", line 43 in File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/_pytest/assertion/rewrite.py", line 168 in exec_module File "", line 680 in _load_unlocked File "", line 986 in _find_and_load_unlocked File "", line 1007 in _find_and_load File "", line 1030 in _gcd_import File "/Users/koer2434/opt/anaconda3/lib/python3.9/importlib/init.py", line 127 in import_module File "/Users/koer2434/opt/anaconda3/lib/python3.9/site-packages/_pytest/pathlib.py", line 533 in import_path

Ajstros commented 2 years ago

@lucask07 I created a power_supply fixture with a "session" scope in the conftest.py file in the packaging branch. Can you check that this fixed the issue? I believe it is linked to that commit so it should automatically close this issue when that pull request (#12) goes through

Ajstros commented 2 years ago

Tried to fix in #12 with 714d01c9fce775534182cdd80cc855679f6e2347, didn't seem to work.

lucask07 commented 2 years ago

@Ajstros this worked and enabled no_fpga testing with the MAC. Realized that the only reason it is needed is because the current NI-VISA and MAC Monterey are not compatible.