File: conftest.py

package info (click to toggle)
python-echo 0.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 368 kB
  • sloc: python: 2,421; makefile: 148
file content (32 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from __future__ import absolute_import, division, print_function

try:
    import qtpy  # noqa
except Exception:
    QT_INSTALLED = False
else:
    QT_INSTALLED = True

qapp = None


def get_qapp():
    global qapp
    from qtpy import QtWidgets
    qapp = QtWidgets.QApplication.instance()
    if qapp is None:
        qapp = QtWidgets.QApplication([''])
    return qapp


def pytest_configure(config):
    if QT_INSTALLED:
        from qtpy import QtWidgets  # noqa
        app = get_qapp()  # noqa


def pytest_unconfigure(config):
    if QT_INSTALLED:
        global qapp
        qapp.exit()
        qapp = None