def testCase(self): o = QObject() o.deleteLater() del o QTimer.singleShot(100, self.app.quit) self.app.exec_()