Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Avoid mocking Anki modules globally #175

Merged
merged 4 commits into from
Nov 7, 2022

Conversation

aplaice
Copy link
Collaborator

@aplaice aplaice commented Nov 6, 2022

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

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 Stvad#145.
@aplaice aplaice force-pushed the stop_mocking_modules_globally branch from 5d1cb75 to f23089d Compare November 7, 2022 00:18
I think that this is the simpler approach.  See: pypa/pipenv/issues/
1575.
@aplaice aplaice force-pushed the stop_mocking_modules_globally branch from f23089d to b7b81e7 Compare November 7, 2022 00:22
Copy link
Contributor

@ohare93 ohare93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 👍

@aplaice
Copy link
Collaborator Author

aplaice commented Nov 7, 2022

Looks great +1

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

@aplaice aplaice merged commit 1b1252c into Stvad:master Nov 7, 2022
@aplaice aplaice deleted the stop_mocking_modules_globally branch November 7, 2022 08:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stop mocking Anki modules globally
2 participants