Skip to main content

Live image viewer application for photon science detectors.

Project description

Authors: Jan Kotański <jan.kotanski at>


This is a simple helper module to perform PyQt GUI tests.

With the qtchecker module its user

  1. creates QtChecker object with the global QApplication object and a given tested QWidget dialog parameters

  2. defines a sequence of checks with setChecks() method and the following helper classes:

  • AttrCheck - read a tested dialog attribute value

  • CmdCheck - execute a tested dialog command and read its result value

  • WrapAttrCheck - execute a wrapper command on a tested dialog attribute

  • WrapCmdCheck - execute a wrapper command on a result value of a tested dialog command

  • ExtAttrCheck - read an external attribute value defined outside the dialog

  • ExtCmdCheck - execute an external command defined outside the dialog and read its result value

  1. starts event loop and performs checkes with executeChecks() or executeChecksAndClose() method

  2. compare results by reading results attribute of executing

for example

import unittest

from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5 import QtTest

from qtchecker.qtChecker import QtChecker, CmdCheck, WrapAttrCheck, ExtCmdCheck

# import my dialog module
from lavuelib import liveViewer

# QApplication object should be one for all tess
app = QtGui.QApplication([])

class GuiTest(unittest.TestCase):

    def __init__(self, methodName):
        unittest.TestCase.__init__(self, methodName)

    def test_run(self):

        # my tested MainWindow dialog
        dialog = liveViewer.MainWindow()

        # create QtChecker object
        qtck = QtChecker(app, dialog)

        # define a sequence of action of the dialog
            # read return value of execute isConnected command
                # a python path to a method executed in the first action
            # click pushButton with the left-mouse-click
                # a python path to an pushButton object
                # Wrapper command to be executed on the action object
                # additional parameters of the wrapper command
            # read a result of external "getLAvueState" command
                # parent object of the external command
                # external command name

        # execute the check actions and close the dialog
        status = qtck.executeChecksAndClose()
        self.assertEqual(status, 0)

        # compare results returned by each action
                # a result of isConnected() command
                # a result of the mouseClick on the pushButton
                # a result of getLavueState() command
                '{"connected": false}'

   def getLavueState(self):
       """ an external command """

       import tango
       return tango.DeviceProxy("po/lavuecontroller/1").LavueState

More examples can be found at like LavueTests or LavueStateTests.


QtChecker requires the following python packages: qt4 or qt5 or pyqtgraph.

From sources

Download the latest QtChecker version from

Extract sources and run

$ python install

The script may need: setuptools sphinx python packages as well as qtbase5-dev-tools or libqt4-dev-bin.

Debian packages

Debian buster and stretch or Ubuntu focal, eoan, bionic packages can be found in the HDRI repository.

To install the debian packages, add the PGP repository key

$ sudo su
$ wget -q -O - | apt-key add -

and then download the corresponding source list, e.g.

$ cd /etc/apt/sources.list.d


$ wget


$ wget


$ wget



$ apt-get update
$ apt-get install python-qtchecker
$ apt-get update
$ apt-get install python3-qtchecker

for python 3 version.

From pip

To install it from pip you need to install pyqt5 in advance, e.g.

$ python3 -m venv myvenv
$ . myvenv/bin/activate

$ pip install pyqt5

$ pip install qtchecker

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qtchecker-0.4.0.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

qtchecker-0.4.0-py3-none-any.whl (6.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page