-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Mock synchronisation issues on Windows only (Linux/OSX fine) #855
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
Comments
N.B. Uncommenting the lines beginning |
@cormacc thanks for the elaborated issue, it's interesting you are using In the meantime, I was wondering if you can get more sightful details from |
That's handy @byronz -- hadn't known about the --pdb arg to pytest (I'm mainly a c/embedded guy). So it does seem to be some sort of time-dependent / synchronisation issue. With that self-contained example, the test is still failing, but by the time I get to inspect the mock object at the pdb prompt, the mock state has caught up with expectations....
And it turns out that if I inject a This result is pretty repeatable, but doesn't appear to be deterministic -- I did get one failure at |
Another interesting (but unrelated) bit of platform-specific weirdness that's cropped up in one of my actual tests -- almost identical to this one, but with a more complex app layout and mocking our own rather than a library function -- is that I need to call the |
Uggh -- behaviour on windows seems highly non-deterministic -- waits and click events work for one test and not another, or works once, then not again. Vaguely stateful behaviour? @byronz do you reckon this is more likely to be an upstream issue with selenium on windows than a dash-testing/selenium integration issue? Behaviour on linux and osx seems consistent and reliable. Worst case I can just setup a CI build on a dedicated webtest branch and have my windows-based colleagues commit to that to run their tests. Though need to figure out #829 first. |
TBH, the first impression without digging into your details was: Oh windows! I have roughly these scenarios in mind:
agree that #829 has higher priority for us, the remote scenario was not used internally in plotly though, I will try test with a selenium grid docker cluster and fix it good luck! |
Thanks @byronz However the similar example using my more complex actual layout behaves differently -- again robust/deterministic on the two posix platforms, but call traces AND selenium-driven browser behaviour is erratic on Windows -- e.g. sometimes the call to clear_input() does nothing and the subsequent call to send_keys() does, and the call traces (after artificial wait) don't match expectations, but partially match the observed behaviour in the browser. This may be another manifestation of the root cause of my mock call tracing woes, or compounded by another platform-specific issue -- e.g. (off the top of my head) werkzeug on windows struggling to keep up with callbacks. We had some issues with this early on (used pywebview/trident and werkzeug earlier on, and observed some callback pre-emption issues with a dcc.Interval which we resolved by moving to pywebview/cef and cheroot). Anyway, I'm going OT - thanks for the help - I'll keep an eye on #829 |
Describe your context
Previously tested with dash 1.0.2 -- same behaviour observed.
Browser, Version and OS
Describe the bug
Unit tests using dash-testing / selenium clear_input() / send_keys() methods drive browser input as expected (verified visually -- inserting artificial time.sleep() statements on occasion to be sure). Mocked functions capture some but not all invocations. In some cases, inserting additional calls to clear_input() appears to cause some internal (?inter-process?) synchronisation of the mock to occur, capturing the outstanding invocations. However this is inconsistent -- the workaround shown in the self-contained example below works consistently in that example, but not in other very similar tests in our codebase.
Expected behavior
Mocks record invocations from all callback invocations without need for additional attempts to flush/synchronise. I.e. behaviour consistent with expectations / verified behaviour on Linux and OSX.
Self-contained example
The text was updated successfully, but these errors were encountered: