Stvad / CrowdAnki

Plugin for Anki SRS designed to facilitate cooperation on creation of notes and decks.
MIT License
520 stars 44 forks source link

Avoid mocking Anki modules globally #175

Closed aplaice closed 1 year ago

aplaice commented 1 year ago

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. :/)

aplaice commented 1 year ago

Looks great +1

Thanks! (though I'm not too happy about the additional pywin32 module mocking.)