-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
I observe weird problems running pytest tests with pyvisa-sim backed fixture objects, in that replies remain in a read buffer despite the objects + resource managers being destroyed:
>>> import pyvisa
>>> rm = pyvisa.ResourceManager(visa_library='@sim')
>>> instr = rm.open_resource('ASRL2::INSTR')
>>> instr.write('*IDN?')
7
>>> instr.read()
'SCPI,MOCK,VERSION_1.0\n' # OK, that's what I expect
>>> instr.write('*IDN?') # we don't fetch that response from the instrument
7
>>> id(instr)
140011221241280
>>> del instr # Kill the instrument (or instr.close())
>>> del rm # (or rm.close())
>>> rm = pyvisa.ResourceManager(visa_library='@sim')
>>> instr = rm.open_resource('ASRL2::INSTR')
>>> instr.read() # Why is this response in this different instrument object?
'SCPI,MOCK,VERSION_1.0\n'
>>> id(instr)
140011221241472 # the IDs of the instr objects are different, so it's not somehow the sameTo fix/avoid this, one needs to call rm.close(). instr.close() is neither sufficient nor necessary.
Matthieu said:
The fact that closing the instrument does not solve the issue still says that something is off. Instruments do not share outgoing buffers between connections and we should mimic that.
Originally posted by @bilderbuchi in #68 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels