-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
qtbot fails in github actions if cv2 is imported #396
Comments
I forked your repository and replaced the CI by a simple script which just does: from PyQt5.QtWidgets import QApplication
import cv2
app = QApplication([]) and that fails as well:
. It looks like |
Thanks. I found opencv/opencv-python#386, and using For anyone that might encounter same issue:
|
@The-Compiler Although this is not related to pytest-qt, I think someone else might fall into same trap. I would like to document this if you think it's ok. |
I guess it wouldn't hurt to add this to the troubleshooting page if you want to. Though you got me curious: How come you use that combination of Qt and cv2 in the tests, but not in your application code? |
I used them in my application as well. But strangely, nothing went wrong in my Windows local machine when I ran my app and tests. |
If you still want to use import os
from PyQt5.QtCore import QLibraryInfo
# from PySide2.QtCore import QLibraryInfo
import cv2
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = QLibraryInfo.location(
QLibraryInfo.PluginsPath
) |
What I encountered
I imported
cv2
module in my testing file, and github action fails with similar error in #293 .However, when I lazy-import
cv2
by loading it inside function block, the error disappears.Reproducing the error
I made a repository to reproduce this error : https://github.com/JSS95/pytestqt-githubaction
In commit 976f3af, I imported
cv2
in function block and the test does not fail.In commit f23f189, I imported
cv2
at the top of the file and the test fails.My environment
I am using
PyQt5
withpytest-qt
. My CI ran on ubuntu, Python 3.7.I followed the troubleshooting guide in the document, and all was well before I import cv2.
Error log
The text was updated successfully, but these errors were encountered: