You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
>>>importpyvisa>>>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 instrument7>>>id(instr)
140011221241280>>>delinstr# Kill the instrument (or instr.close())>>>delrm# (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 same
To 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.
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:
To fix/avoid this, one needs to call
rm.close()
.instr.close()
is neither sufficient nor necessary.Matthieu said:
Originally posted by @bilderbuchi in #68 (comment)
The text was updated successfully, but these errors were encountered: