blob: e02b574761dcfe02219bd27387ae94d135911b9c (
plain)
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
|
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
'''Helper classes and functions'''
import gc
import unittest
from PySide6.QtGui import QGuiApplication
class UsesQGuiApplication(unittest.TestCase):
'''Helper class to provide QGuiApplication instances'''
def setUp(self):
'''Creates the QGuiApplication instance'''
# Simple way of making instance a singleton
super(UsesQGuiApplication, self).setUp()
self.app = QGuiApplication.instance() or QGuiApplication([])
def tearDown(self):
'''Deletes the reference owned by self'''
del self.app
# PYSIDE-535: Need to collect garbage in PyPy to trigger deletion
gc.collect()
super(UsesQGuiApplication, self).tearDown()
|