Avoid mocking Anki modules globally #175
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ideally, we'd stop mocking them at all but this is a good first step, as it's annoying and surprising (with the current/previous global mocking, the test is/was run differently depending on whether it was run individually or as part of a batch).
Fix #145.
(The solution could probably be neater (e.g. we could use a context manager), but I don't think it's worth it.)
(The reproduction in #145 no longer works, as-is, as the tests don't crash even without mocking. (Edit: famous last words :D (though AFAICT the issue is PyQt5.QtWebEngineWidgets not wanting to be imported on Windows rather than a bug in our code).)
The issue is now
pywin32
which might be tricky getting into the pipenv (even if we wanted to...). (Mocking it might be a simpler approach. :/)