I have a pyqt application and like to test scripts for testing this application.
I was able to build the qapplication during my standalone testing. Not sure how to c
A QApplication must be created before creating any widget since it handles the eventloop
import unittest
import same_label
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
class Test(unittest.TestCase):
def setUp(self):
ex = same_label.Example()
def tearDown(self):
pass
def testName(self):
pass
if __name__ == "__main__":
#import sys;sys.argv = ['', 'Test.testName']
unittest.main()
In the following link there is an example: http://johnnado.com/pyqt-qtest-example/, another option is to use the pytest-qt package