pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

Fix #351 - Avoid calling set_configuration if there is already an act… #352

Closed cpagravel closed 1 year ago

cpagravel commented 1 year ago

This PR addresses issue #351 . It will avoid calling set_configuration if there is already an active interface.

codecov-commenter commented 1 year ago

Codecov Report

Merging #352 (236f043) into main (c0c005e) will decrease coverage by 0.04%. The diff coverage is 0.00%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main     #352      +/-   ##
==========================================
- Coverage   22.44%   22.41%   -0.04%     
==========================================
  Files          21       21              
  Lines        3221     3226       +5     
  Branches      446      447       +1     
==========================================
  Hits          723      723              
- Misses       2480     2486       +6     
+ Partials       18       17       -1     
Flag Coverage Δ
unittests 22.41% <0.00%> (-0.04%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyvisa_py/protocols/hislip.py 27.33% <ø> (ø)
pyvisa_py/protocols/rpc.py 22.02% <ø> (ø)
pyvisa_py/protocols/usbraw.py 0.00% <ø> (ø)
pyvisa_py/protocols/usbtmc.py 0.00% <0.00%> (ø)
pyvisa_py/sessions.py 41.50% <ø> (ø)
pyvisa_py/tcpip.py 20.74% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

MatthieuDartiailh commented 1 year ago

Looks good. Can you fix the formatting issue and add an entry to the release notes (under 0.6.2, since I believe this warrants a patch release).

cpagravel commented 1 year ago

Sure. The formatting issues are inside unrelated files. I can format them to fix the failing tests.

cpagravel commented 1 year ago

Ah, it looks like the file I modified also fails. I checked it locally using black. There's probably some configuration differences. I'll dig into this a bit more.

cpagravel commented 1 year ago
(p3) @chrisgravel-macbookpro2[~/dev/pyvisa-py](main) ✔ black pyvisa_py --check
would reformat /Users/chrisgravel/dev/pyvisa-py/pyvisa_py/protocols/usbraw.py
would reformat /Users/chrisgravel/dev/pyvisa-py/pyvisa_py/sessions.py
would reformat /Users/chrisgravel/dev/pyvisa-py/pyvisa_py/protocols/hislip.py
would reformat /Users/chrisgravel/dev/pyvisa-py/pyvisa_py/protocols/rpc.py
would reformat /Users/chrisgravel/dev/pyvisa-py/pyvisa_py/tcpip.py

Any idea what I'm missing here?

I'm trying to highlight the fact that the check with black fails on the usbtmc.py in the CI test, but it doesn't fail locally. I'm using the same Black version: 23.1.0.

cpagravel commented 1 year ago

Found the issue. I ran formatting locally, and black automatically applied the changes without me realizing it. Pushed the formatting fixes.

MatthieuDartiailh commented 1 year ago

Thanks for the PR ! I will cut the release shortly.