New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapter rework #660
Adapter rework #660
Conversation
You're crazy! 👏 😁 |
b7514e7
to
bc9f93c
Compare
I hope you have not bitten off too much here, a ultralarge PR could make reviewing quite difficult. |
re: your questions:
I think the read_binary and write_binary should be where read and write are. Not sure about the _values methods.
Not a strong opinion, but replacing base class methods (without calling them, i.e. not just wrapping them) always feels a bit suboptimal/smelly to me -- there could be additional treatments/logging/housekeeping that you would miss in this way.
If that is not good for some reason, we could also use a class attribute that Instrument.ask uses if not None (but I'm hesitant to strew random attributes around, especially because users define a lot of properties on our classes) ping @msmttchr @CasperSchippers though, I remember we discussed this before.
It's used in some tests, and in SwissArmyFake and FakeInstrument, but maybe could be pulled into the latter as an internal class if the tests can be restructured. |
re:
This is what pytest parametrization is made for. |
#570 (nearly ready for merge) will also be interesting to consider for the rework -- custom read, overridden ask, prologix adapter. And it has tests (for connected device only). :-) |
Thanks for your comments. It's still a work in progress, but I wanted to get some ideas (mainly those in the questions section), therefore I opened the pull request.
The Test Generator, in turn defines how the Adapter have to do the logging. So, in the end, everything (besides the first tests) hang together.
I know. It will make things a lot more complicated, if the test generator automatically notices, that it tested several times the same property and generates a parametrized test instead of individual test. Right now the generator writes every single completed test to the output file and does not aggregate tests into one. Let's keep the Test generator simple for this first PR, just, that it works together with the Adapters.
Thank you for your suggestions and comments. I have not yet used those, therefore I appreciate your comments, in the meanwhile I marked somehow the deprecated parts. For that reason, the messages are not yet very descriptive (it's a draft). I focused on the implementation itself.
One point is "rework new instruments", as I have to check those as well, which came after protocol-tests branched off master. They won't be forgotten. |
All good, I understand that it's a draft, I just wanted to give some early feedback
Splitting along those lines sounds good! (and your current groundwork will already inform those different parts).
👍 |
5235fed
to
cfc3f6c
Compare
96862d9
to
79fcdd0
Compare
The official adapters and the One question remains: What do we do with the read/write_binary_values?
Some design thoughts I implemented to better understand the code:
Thank you @bilderbuchi for your many reviews and tipps in the last pull requests. I learned a lot and produced better codes with your help. |
Great, I'll try to do this bit-by-bit, hopefully over the coming week :-)
Sounds good!
Sounds good! |
I don't know right now, and I don't have strong intuition about it (yet), especially the *values methods. As long as we're restructuring, we should take the opportunity to make/keep the method pairs consistent in naming and abstraction level/location. If
Sounds good in principle -- separate the communication details from the "orchestration"/coordination of reads/writes.
👍
Interchangeability is good! Maybe at one point we can even harmonise the timeout units. :D
Sure! 😃 I think the work pays off because we get higher-quality future contributions, so reviewing will be less effort! |
I don't want to pull this into this PR to avoid increasing the already large scope even more, but if you have the time take a look how the device in #239 does frame-based communication. |
The force push before and the one now contain only a rebase onto the updated master. The last commit contains changes to the documentation and one for the Instrument, according to your comments. |
I think we're approaching the home stretch! I'm not sure if all the "44 unresolved conversations" shown by the merge dialog are true, or if the PR machinery got confused somehow by the rebasing? My remaining conversations/remarks should be straightforward to deal with. |
I did not get a notification about your remarks 17 days ago... |
@bilderbuchi I implemented the change requests in the last two commits. I resolved your lauding comments (great, awesome etc.) as I guess you do not need to look at them again. |
Sure! I wanted to make sure that you realise that we really appreciate this huge effort, but yes, I don't need the comments any more. :-) |
I verified, that even without a regular output, the |
Perfect! |
So, I guess now you have to go back to the top and check which boxes have been completed in the meantime? :-) |
I verified the instruments' changes. With that, we're good to merge. |
Thank you. I think it's time to pull the trigger to put this huge PR to rest! 🎉 |
@bmoneke we missed some test warnings that are generated (because they're warnings, not errors :D), do you think we can fix them quickly, or should I file a separate issue?
|
The first issue I already knew. For that reason I had wanted to rewrite The second issue is a tiny fix in the test (
|
I can do a pull request if you do not want to change just that line directly to master, @bilderbuchi . |
It's fine, I just pushed it. Thanks! |
Reworking the instrument/adapter. This pull request just focuses on the official adapters, Instrument class and keeping the code base in a working condition.
Fixes #567, fixes #512, fixes #409, fixes #219.
Roadmap of different parts (PRs)
Open questions
Adapter rework
General
test_instrument_with_device.py
: add appropriate comment into documentation)Official adapters
Instruments and special adapters
Special Adapters ensure, that they work with the modified adapters
Test special adapters change
Rewrite instruments communication (read/write...) to adapt to these changes
Verify rewritten instruments
Small adjustments (change adapter calls to instrument calls)
Verify adjusted instruments
Check newly added / modified instruments
Clean up
Issues and discussions