Closed amsyrena closed 11 months ago
Yes, this is a limitation of the actual client, it works fully synchronously. We either return None or wait a certain amount of time in case a response happens. Maybe I could add a feature to do this wait.
Is it required in your case?
Thank you very much for your reply! According to ISO-14229, I think this situation exists. When we write test cases, we really need to test such situations. I would be grateful if you could add this feature! Thank you very much for providing this open source library, which has been of great help to us.
Can you try this branch? https://github.com/pylessard/python-udsoncan/tree/support-wait-nrc-when-suppress-pos-resp
with client.suppress_positive_response(wait_nrc=True):
pass
I'm waiting on your feedback to merge
Sorry for replying to you only now. Thank you very much for your modification. I tested it and it works very well and meets my needs very well. Thank you very very much!
Thank you for your feedback. Merged.
Fixed by #174
When will the official new version be released?
I have no plan. I can do it now if it helps you
Yes, I need the new version, downloaded via pip. grateful!
There you go sir. v1.19.0 is published on pypi. Cheers
Thanks! Have a great day or evening!
I use it like this:
with pytest.raises(NegativeResponseException) as handle:
with uds.suppress_positive_response(wait_nrc=True):
uds.start_routine(routine_id=routine_id, data=data)
assert handle.value.response.code == 0x13, 'nrc13 not raise'
with pytest.raises(TimeoutError):
with uds.suppress_positive_response(wait_nrc=True):
uds.change_session(2)
The NRC response is expected when I request 'suppress_positive_response' massage. Like this:
But the code is 'return None', and will not check the response.