diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-04-02 17:48:13 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-04-04 08:49:54 +0200 |
commit | ef3c3697b058d638802866e8eaba653fb6040d13 (patch) | |
tree | 6a9603f96a30d7b462acff094182d5ae9fd2c486 /sources/pyside6 | |
parent | 8b479a0260aab49243a2fca328bda96c261c23e6 (diff) |
Fix flake8-warnings in signals tests
Pick-to: 6.7
Task-number: PYSIDE-2646
Change-Id: I4f6b5d642f540fb3f5f2e219057c862fe5998a21
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6')
27 files changed, 23 insertions, 56 deletions
diff --git a/sources/pyside6/tests/signals/bug_311.py b/sources/pyside6/tests/signals/bug_311.py index f2bbbc093..e27476172 100644 --- a/sources/pyside6/tests/signals/bug_311.py +++ b/sources/pyside6/tests/signals/bug_311.py @@ -52,4 +52,3 @@ class SignaltoSignalTest(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/bug_312.py b/sources/pyside6/tests/signals/bug_312.py index de1a2f6a8..8b4d65c55 100644 --- a/sources/pyside6/tests/signals/bug_312.py +++ b/sources/pyside6/tests/signals/bug_312.py @@ -58,5 +58,3 @@ class MultipleSlots(unittest.TestCase): if __name__ == '__main__': unittest.main() - - diff --git a/sources/pyside6/tests/signals/bug_319.py b/sources/pyside6/tests/signals/bug_319.py index bae0d8fdb..657733afb 100644 --- a/sources/pyside6/tests/signals/bug_319.py +++ b/sources/pyside6/tests/signals/bug_319.py @@ -45,4 +45,3 @@ class SignaltoSignalTest(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/bug_79.py b/sources/pyside6/tests/signals/bug_79.py index 0e12301f2..77ac621d5 100644 --- a/sources/pyside6/tests/signals/bug_79.py +++ b/sources/pyside6/tests/signals/bug_79.py @@ -30,7 +30,7 @@ class ConnectTest(unittest.TestCase): def testNoLeaks_ConnectAndDisconnect(self): self._called = None - app = QApplication([]) + app = QApplication([]) # noqa: F841 o = QTreeView() o.setModel(QStandardItemModel()) o.selectionModel().destroyed.connect(self.callback) diff --git a/sources/pyside6/tests/signals/invalid_callback_test.py b/sources/pyside6/tests/signals/invalid_callback_test.py index b5252870c..61ba444e5 100644 --- a/sources/pyside6/tests/signals/invalid_callback_test.py +++ b/sources/pyside6/tests/signals/invalid_callback_test.py @@ -40,4 +40,3 @@ class InvalidCallback(unittest.TestCase): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/lambda_gui_test.py b/sources/pyside6/tests/signals/lambda_gui_test.py index 45a6d6acf..736b800bf 100644 --- a/sources/pyside6/tests/signals/lambda_gui_test.py +++ b/sources/pyside6/tests/signals/lambda_gui_test.py @@ -33,7 +33,7 @@ if hasQtGui: # Connecting a lambda to a QPushButton.clicked() obj = QPushButton('label') ctr = Control() - func = lambda: setattr(ctr, 'arg', True) + func = lambda: setattr(ctr, 'arg', True) # noqa: E731 obj.clicked.connect(func) obj.click() self.assertTrue(ctr.arg) @@ -44,7 +44,7 @@ if hasQtGui: obj = QSpinBox() ctr = Control() arg = 444 - func = lambda x: setattr(ctr, 'arg', 444) + func = lambda x: setattr(ctr, 'arg', 444) # noqa: E731 obj.valueChanged.connect(func) obj.setValue(444) self.assertEqual(ctr.arg, arg) diff --git a/sources/pyside6/tests/signals/leaking_signal_test.py b/sources/pyside6/tests/signals/leaking_signal_test.py index e7aff9628..666ae7a13 100644 --- a/sources/pyside6/tests/signals/leaking_signal_test.py +++ b/sources/pyside6/tests/signals/leaking_signal_test.py @@ -4,7 +4,6 @@ import os import sys import unittest -import weakref from pathlib import Path sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) @@ -21,7 +20,7 @@ class LeakingSignal(unittest.TestCase): class Emitter(QObject): my_signal = Signal(object) - emitter = Emitter() + emitter = Emitter() # noqa: F841 if __name__ == '__main__': diff --git a/sources/pyside6/tests/signals/multiple_connections_gui_test.py b/sources/pyside6/tests/signals/multiple_connections_gui_test.py index 097811750..4afb3daff 100644 --- a/sources/pyside6/tests/signals/multiple_connections_gui_test.py +++ b/sources/pyside6/tests/signals/multiple_connections_gui_test.py @@ -1,9 +1,7 @@ # Copyright (C) 2022 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -from functools import partial import os -import random import sys import unittest diff --git a/sources/pyside6/tests/signals/pysignal_test.py b/sources/pyside6/tests/signals/pysignal_test.py index e3d6a55da..61dd537a5 100644 --- a/sources/pyside6/tests/signals/pysignal_test.py +++ b/sources/pyside6/tests/signals/pysignal_test.py @@ -14,7 +14,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, SLOT, Qt try: - from PySide6.QtWidgets import QSpinBox, QApplication, QWidget + from PySide6.QtWidgets import QSpinBox, QApplication, QWidget # noqa: F401 hasQtGui = True except ImportError: hasQtGui = False @@ -97,7 +97,7 @@ class PythonSigSlot(unittest.TestCase): def tearDown(self): try: del self.args - except: + except: # noqa: E722 pass # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() diff --git a/sources/pyside6/tests/signals/qobject_destroyed_test.py b/sources/pyside6/tests/signals/qobject_destroyed_test.py index 08807e78e..a21762b41 100644 --- a/sources/pyside6/tests/signals/qobject_destroyed_test.py +++ b/sources/pyside6/tests/signals/qobject_destroyed_test.py @@ -11,7 +11,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, SIGNAL +from PySide6.QtCore import QObject class QObjectDestroyed(unittest.TestCase): diff --git a/sources/pyside6/tests/signals/ref01_test.py b/sources/pyside6/tests/signals/ref01_test.py index a830b55dd..1a62b2218 100644 --- a/sources/pyside6/tests/signals/ref01_test.py +++ b/sources/pyside6/tests/signals/ref01_test.py @@ -37,5 +37,3 @@ class BoundAndUnboundSignalsTest(unittest.TestCase): if __name__ == '__main__': unittest.main() - - diff --git a/sources/pyside6/tests/signals/ref02_test.py b/sources/pyside6/tests/signals/ref02_test.py index e0d71cff5..54b6f4a52 100644 --- a/sources/pyside6/tests/signals/ref02_test.py +++ b/sources/pyside6/tests/signals/ref02_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QCoreApplication, QTimeLine +from PySide6.QtCore import QTimeLine from helper.usesqapplication import UsesQApplication @@ -58,4 +58,3 @@ class NativeSignalsTest(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/ref03_test.py b/sources/pyside6/tests/signals/ref03_test.py index 2df2d7cef..c43c2e549 100644 --- a/sources/pyside6/tests/signals/ref03_test.py +++ b/sources/pyside6/tests/signals/ref03_test.py @@ -40,4 +40,3 @@ class DisconnectSignalsTest(unittest.TestCase): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/ref04_test.py b/sources/pyside6/tests/signals/ref04_test.py index b478aff2a..fce801456 100644 --- a/sources/pyside6/tests/signals/ref04_test.py +++ b/sources/pyside6/tests/signals/ref04_test.py @@ -53,17 +53,6 @@ class UserSignalTest(unittest.TestCase): self.emitter.mySignal.emit() self.assertEqual(self.counter, 2) -# def testConnectWithConfigureMethod(self): -# -# def slot(): -# self.counter += 1 -# -# self.emitter.pyqtConfigure(mySignal=slot) -# self.assertEqual(self.counter, 0) -# self.emitter.mySignal.emit() -# self.assertEqual(self.counter, 1) - if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/ref05_test.py b/sources/pyside6/tests/signals/ref05_test.py index b6c5b4a10..fb9debf39 100644 --- a/sources/pyside6/tests/signals/ref05_test.py +++ b/sources/pyside6/tests/signals/ref05_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Slot +from PySide6.QtCore import QObject, QTimeLine, Slot from helper.usesqapplication import UsesQApplication @@ -56,4 +56,3 @@ class UserSlotTest(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/ref06_test.py b/sources/pyside6/tests/signals/ref06_test.py index 21fbe545c..a827131db 100644 --- a/sources/pyside6/tests/signals/ref06_test.py +++ b/sources/pyside6/tests/signals/ref06_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, QCoreApplication, QTimeLine, Signal, Slot +from PySide6.QtCore import QObject, QTimeLine, Signal, Slot from helper.usesqapplication import UsesQApplication @@ -59,4 +59,3 @@ class SignaltoSignalTest(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/segfault_proxyparent_test.py b/sources/pyside6/tests/signals/segfault_proxyparent_test.py index c85ab10c0..7107b8278 100644 --- a/sources/pyside6/tests/signals/segfault_proxyparent_test.py +++ b/sources/pyside6/tests/signals/segfault_proxyparent_test.py @@ -44,7 +44,7 @@ class SegfaultCase(unittest.TestCase): def tearDown(self): try: del self.args - except: + except: # noqa: E722 pass # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() @@ -73,4 +73,3 @@ class SegfaultCase(unittest.TestCase): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/self_connect_test.py b/sources/pyside6/tests/signals/self_connect_test.py index feb966d27..296e1dabb 100644 --- a/sources/pyside6/tests/signals/self_connect_test.py +++ b/sources/pyside6/tests/signals/self_connect_test.py @@ -13,9 +13,8 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, SIGNAL, SLOT +from PySide6.QtCore import QObject, Slot, SIGNAL, SLOT from PySide6.QtWidgets import QPushButton, QWidget -from PySide6.QtCore import QObject, Slot from helper.usesqapplication import UsesQApplication @@ -25,7 +24,7 @@ class Receiver(QObject): super().__init__(p) self.triggered = False - @Slot(bool,int) + @Slot(bool, int) def default_parameter_slot(self, bool_value, int_value=0): self.triggered = True diff --git a/sources/pyside6/tests/signals/short_circuit_test.py b/sources/pyside6/tests/signals/short_circuit_test.py index 434518336..e9d64e69b 100644 --- a/sources/pyside6/tests/signals/short_circuit_test.py +++ b/sources/pyside6/tests/signals/short_circuit_test.py @@ -11,7 +11,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, SIGNAL, SLOT +from PySide6.QtCore import QObject, SIGNAL class Dummy(QObject): @@ -27,7 +27,7 @@ class ShortCircuitSignals(unittest.TestCase): def tearDown(self): try: del self.args - except: + except: # noqa: E722 pass # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion gc.collect() diff --git a/sources/pyside6/tests/signals/signal2signal_connect_test.py b/sources/pyside6/tests/signals/signal2signal_connect_test.py index c755a9dca..8ace7f8cb 100644 --- a/sources/pyside6/tests/signals/signal2signal_connect_test.py +++ b/sources/pyside6/tests/signals/signal2signal_connect_test.py @@ -34,11 +34,11 @@ class TestSignal2SignalConnect(unittest.TestCase): # Delete used resources try: del self.sender - except: + except: # noqa: E722 pass try: del self.forwarder - except: + except: # noqa: E722 pass del self.args # PYSIDE-535: Need to collect garbage in PyPy to trigger deletion @@ -116,5 +116,3 @@ class TestSignal2SignalConnect(unittest.TestCase): if __name__ == '__main__': unittest.main() - - diff --git a/sources/pyside6/tests/signals/signal_autoconnect_test.py b/sources/pyside6/tests/signals/signal_autoconnect_test.py index 820a77444..51d1cea3a 100644 --- a/sources/pyside6/tests/signals/signal_autoconnect_test.py +++ b/sources/pyside6/tests/signals/signal_autoconnect_test.py @@ -27,7 +27,7 @@ class MyObject(QWidget): class AutoConnectionTest(unittest.TestCase): def testConnection(self): - app = QApplication([]) + app = QApplication([]) # noqa: F841 win = MyObject() btn = QPushButton("click", win) diff --git a/sources/pyside6/tests/signals/signal_emission_gui_test.py b/sources/pyside6/tests/signals/signal_emission_gui_test.py index aae96f236..10b5946ef 100644 --- a/sources/pyside6/tests/signals/signal_emission_gui_test.py +++ b/sources/pyside6/tests/signals/signal_emission_gui_test.py @@ -14,7 +14,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, SIGNAL, SLOT +from PySide6.QtCore import SIGNAL try: from PySide6.QtWidgets import QSpinBox, QPushButton diff --git a/sources/pyside6/tests/signals/signal_emission_test.py b/sources/pyside6/tests/signals/signal_emission_test.py index 1439432e9..90cce86c4 100644 --- a/sources/pyside6/tests/signals/signal_emission_test.py +++ b/sources/pyside6/tests/signals/signal_emission_test.py @@ -16,7 +16,6 @@ init_test_paths(False) from PySide6.QtCore import QObject, SIGNAL, SLOT, QProcess, QTimeLine -from helper.basicpyslotcase import BasicPySlotCase from helper.usesqapplication import UsesQApplication diff --git a/sources/pyside6/tests/signals/signal_manager_refcount_test.py b/sources/pyside6/tests/signals/signal_manager_refcount_test.py index 31d3bc85e..1ca1ea55f 100644 --- a/sources/pyside6/tests/signals/signal_manager_refcount_test.py +++ b/sources/pyside6/tests/signals/signal_manager_refcount_test.py @@ -16,7 +16,8 @@ from PySide6.QtCore import QObject, SIGNAL class SignalManagerRefCount(unittest.TestCase): - """Simple test case to check if the signal_manager is erroneously incrementing the object refcounter""" + """Simple test case to check if the signal_manager is erroneously incrementing the + object refcounter.""" @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount") def testObjectRefcount(self): @@ -33,4 +34,3 @@ class SignalManagerRefCount(unittest.TestCase): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/signal_signature_test.py b/sources/pyside6/tests/signals/signal_signature_test.py index 59bc1b29f..a7be1ff11 100644 --- a/sources/pyside6/tests/signals/signal_signature_test.py +++ b/sources/pyside6/tests/signals/signal_signature_test.py @@ -99,4 +99,3 @@ class TestConnectNotifyWithNewStyleSignals(UsesQApplication): if __name__ == '__main__': unittest.main() - diff --git a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py index a4d5f33a7..01492b333 100644 --- a/sources/pyside6/tests/signals/signal_with_primitive_type_test.py +++ b/sources/pyside6/tests/signals/signal_with_primitive_type_test.py @@ -10,7 +10,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QCoreApplication, QObject, QTimeLine, SIGNAL +from PySide6.QtCore import QCoreApplication, QTimeLine class SignalPrimitiveTypeTest(unittest.TestCase): @@ -36,5 +36,3 @@ class SignalPrimitiveTypeTest(unittest.TestCase): if __name__ == '__main__': unittest.main() - - diff --git a/sources/pyside6/tests/signals/slot_reference_count_test.py b/sources/pyside6/tests/signals/slot_reference_count_test.py index 10a40597e..e601590a3 100644 --- a/sources/pyside6/tests/signals/slot_reference_count_test.py +++ b/sources/pyside6/tests/signals/slot_reference_count_test.py @@ -12,7 +12,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from PySide6.QtCore import QObject, SIGNAL, SLOT +from PySide6.QtCore import QObject, SIGNAL class Dummy(QObject): |