Closed MichaelWedel closed 7 years ago
Made changes per my comments as discussed.
While testing, I noticed that our nosetests
now take about 4-5 seconds instead of 0.1-0.2 seconds on my machine!!!
We should definitely figure out what's going on there before merging. Seems to hang one a few tests in particular.
Have we missed anything more? While fixing the tests I discovered that the connect-disconnect test for AdapterCollection
failed sporadically. This blocks now until the adapter thread has completed the startup, so there's no synchronisation problem anymore.
Does mocking sleep really have any effect?
While we were trying to figure out why the tests were running so slow, I commented out the sleep in simulation at one point to see if it was the cause... and removing it had no effect. I assumed it must be already mocked or otherwise replaced/ignored during the tests.
Good question...I guess it's a kind of "insurance" to make sure sleep
is never actually called even if we add tests later on. simulation.py
is the only place I found where sleep
is really used for something.
We could remove it if you want to, it's not really related.
Looks good, merging!
This fixes #224.
This is a suggestion for how the threaded Adapters could work. As discussed on Slack, the old serial adapter processing has been replaced completely.
AdapterCollection
does not have ahandle
-Method any more, instead theSimulation
simply sleeps for the appropriate time.This still needs work on the Modbus adapter.