pyqtgraph/tests/test_qt.py
Ogi Moore e7a30b9324 Clean up test files
Remove if __name__ == "__main__" bits, replace some == None to is None
checks

Cleanup variety of static code checker issue

Removed missing imports, restructured some logic to make a little
cleaner, fixed a function in test_dockarea, unfortunately broke the test
so now I tell pytest to expect the Exception.
2021-05-31 21:06:16 -07:00

32 lines
914 B
Python

# -*- coding: utf-8 -*-
import pyqtgraph as pg
import os
import pytest
app = pg.mkQApp()
def test_isQObjectAlive():
o1 = pg.QtCore.QObject()
o2 = pg.QtCore.QObject()
o2.setParent(o1)
del o1
assert not pg.Qt.isQObjectAlive(o2)
@pytest.mark.skipif(pg.Qt.QT_LIB == 'PySide', reason='pysideuic does not appear to be '
'packaged with conda')
@pytest.mark.skipif(
pg.Qt.QT_LIB == "PySide2"
and tuple(map(int, pg.Qt.PySide2.__version__.split("."))) >= (5, 14)
and tuple(map(int, pg.Qt.PySide2.__version__.split("."))) < (5, 14, 2, 2),
reason="new PySide2 doesn't have loadUi functionality"
)
def test_loadUiType():
path = os.path.dirname(__file__)
formClass, baseClass = pg.Qt.loadUiType(os.path.join(path, 'uictest.ui'))
w = baseClass()
ui = formClass()
ui.setupUi(w)
w.show()
app.processEvents()