Unknown qExec() in QtTest for Python testcases?
Unsolved
Qt for Python
-
wrote on 24 Sept 2021, 07:38 last edited by
Hi, I want to use QtTest for C++ and Python. In C++ I use
#include <QtTest/QtTest> #include <Test/testcases.h> int main(int argc, char *argv[]) { TestCases testcases; return QTest::qExec(&testcases, argc, argv); }
and it works great. Unfortunately in Python it does not
from PySide6.QtTest import QTest import testcases testcases = testcases.TestCases() QTest.qExec(testcases)
and get the error
AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'qExec'
Although in the Qt Python docu stands
qExec() can be used to execute all test functions in the test object.
https://doc.qt.io/qtforpython/overviews/qtest-overview.html#miscellaneous-options
What I'm doing wrong here? Thks...
-
Hi, I want to use QtTest for C++ and Python. In C++ I use
#include <QtTest/QtTest> #include <Test/testcases.h> int main(int argc, char *argv[]) { TestCases testcases; return QTest::qExec(&testcases, argc, argv); }
and it works great. Unfortunately in Python it does not
from PySide6.QtTest import QTest import testcases testcases = testcases.TestCases() QTest.qExec(testcases)
and get the error
AttributeError: type object 'PySide6.QtTest.QTest' has no attribute 'qExec'
Although in the Qt Python docu stands
qExec() can be used to execute all test functions in the test object.
https://doc.qt.io/qtforpython/overviews/qtest-overview.html#miscellaneous-options
What I'm doing wrong here? Thks...
wrote on 24 Sept 2021, 07:48 last edited by@PowerNow If you are going to implement test in python then it is better to use pytest-qt as it uses pytest + QtTest environment (internally): https://pypi.org/project/pytest-qt/
1/2