aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <[email protected]>2024-12-13 10:12:30 +0100
committerFriedemann Kleint <[email protected]>2024-12-17 16:37:15 +0100
commit45548b18a9e73012521a7b16a234e9689da0d9ab (patch)
tree8f20adad674393e8564e4682bb5d0cc5dd444b26
parentdc41b6a9fb736bb0b6e86470c3d3d016fa88711a (diff)
Fix some flake8 errors in tests/examples
As unearthed by the whitespace change. Pick-to: 6.8 Change-Id: I58c1a38c3c4a9c91719131d7950950ddf475872b Reviewed-by: Cristian Maureira-Fredes <[email protected]>
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py10
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py3
-rw-r--r--sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py1
-rw-r--r--sources/pyside6/tests/QtCore/duck_punching_test.py6
-rw-r--r--sources/pyside6/tests/QtCore/qbitarray_test.py16
-rw-r--r--sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py1
-rw-r--r--sources/pyside6/tests/QtCore/qinstallmsghandler_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qobject_objectproperty_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/qpoint_test.py4
-rw-r--r--sources/pyside6/tests/QtCore/qresource_test.py2
-rw-r--r--sources/pyside6/tests/QtCore/unaryoperator_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpen_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpixmap_test.py2
-rw-r--r--sources/pyside6/tests/QtGui/qpixmapcache_test.py4
-rw-r--r--sources/pyside6/tests/QtGui/qstandarditemmodel_test.py2
-rw-r--r--sources/pyside6/tests/QtSvg/qsvgrenderer_test.py2
-rw-r--r--sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/bug_360.py2
-rw-r--r--sources/pyside6/tests/QtUiTools/uiloader_test.py3
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_480.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_549.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_575.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_576.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_585.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/bug_674.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/customproxywidget_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/keep_reference_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py2
-rw-r--r--sources/pyside6/tests/QtWidgets/qmainwindow_test.py4
-rw-r--r--sources/pyside6/tests/QtWidgets/qpushbutton_test.py2
-rw-r--r--sources/pyside6/tests/util/httpd.py8
32 files changed, 52 insertions, 56 deletions
diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py
index 9e849feab..85e24833f 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py
+++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_widget.py
@@ -22,19 +22,15 @@ class Widget(QWidget):
# QTableView Headers
self.horizontal_header = self.table_view.horizontalHeader()
self.vertical_header = self.table_view.verticalHeader()
- self.horizontal_header.setSectionResizeMode(
- QHeaderView.ResizeToContents
- )
- self.vertical_header.setSectionResizeMode(
- QHeaderView.ResizeToContents
- )
+ self.horizontal_header.setSectionResizeMode(QHeaderView.ResizeToContents)
+ self.vertical_header.setSectionResizeMode(QHeaderView.ResizeToContents)
self.horizontal_header.setStretchLastSection(True)
# QWidget Layout
self.main_layout = QHBoxLayout()
size = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
- ## Left layout
+ # Left layout
size.setHorizontalStretch(1)
self.table_view.setSizePolicy(size)
self.main_layout.addWidget(self.table_view)
diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py
index ce602fa3e..ded7fdf5c 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py
+++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize4/main_window.py
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from __future__ import annotations
-from PySide6.QtCore import Slot
from PySide6.QtGui import QAction, QKeySequence
from PySide6.QtWidgets import QMainWindow
@@ -16,7 +15,7 @@ class MainWindow(QMainWindow):
self.menu = self.menuBar()
self.file_menu = self.menu.addMenu("File")
- ## Exit QAction
+ # Exit QAction
exit_action = QAction("Exit", self)
exit_action.setShortcut(QKeySequence.Quit)
exit_action.triggered.connect(self.close)
diff --git a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py
index e4f40daa4..ded7fdf5c 100644
--- a/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py
+++ b/sources/pyside6/doc/tutorials/datavisualize/datavisualize5/main_window.py
@@ -2,7 +2,6 @@
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
from __future__ import annotations
-from PySide6.QtCore import Slot
from PySide6.QtGui import QAction, QKeySequence
from PySide6.QtWidgets import QMainWindow
diff --git a/sources/pyside6/tests/QtCore/duck_punching_test.py b/sources/pyside6/tests/QtCore/duck_punching_test.py
index 4504aa7d3..2e5b5151b 100644
--- a/sources/pyside6/tests/QtCore/duck_punching_test.py
+++ b/sources/pyside6/tests/QtCore/duck_punching_test.py
@@ -33,7 +33,8 @@ class Duck(QObject):
class TestDuckPunchingOnQObjectInstance(UsesQApplication):
- '''Test case for duck punching new implementations of C++ virtual methods into object instances.'''
+ '''Test case for duck punching new implementations of C++ virtual methods into
+ object instances.'''
def setUp(self):
# Acquire resources
@@ -65,7 +66,8 @@ class TestDuckPunchingOnQObjectInstance(UsesQApplication):
parent.childEvent = None
def testChildEventMonkeyPatchWithInheritance(self):
- # Test if the new childEvent injected on a QObject's extension class instance is called from C++
+ '''Test if the new childEvent injected on a QObject's extension class
+ instance is called from C++'''
parent = Duck()
def childEvent(obj, event):
diff --git a/sources/pyside6/tests/QtCore/qbitarray_test.py b/sources/pyside6/tests/QtCore/qbitarray_test.py
index e97903f0b..4e8908b4c 100644
--- a/sources/pyside6/tests/QtCore/qbitarray_test.py
+++ b/sources/pyside6/tests/QtCore/qbitarray_test.py
@@ -62,8 +62,8 @@ class QBitArrayIsIterableTest(unittest.TestCase):
# Tests if QBitArray class is iterable
qbitarray_is_iterable = True
try:
- bitarray = [bit for bit in self.qbitarray]
- except:
+ bitarray = [bit for bit in self.qbitarray] # noqa F841
+ except: # noqa: E722
qbitarray_is_iterable = False
self.assertTrue(qbitarray_is_iterable)
@@ -81,8 +81,8 @@ class QBitArrayIsIterableTest(unittest.TestCase):
ored_qbitarray, ored_bool_list = None, None
try:
ored_qbitarray = self.qbitarray | self.other_qbitarray
- ored_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)]
- except:
+ ored_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)] # noqa: E501
+ except: # noqa: E722
has_or_bitwise_operator = False
self.assertTrue(has_or_bitwise_operator)
self.assertEqual(bool_list_from_qbitarray(ored_qbitarray), ored_bool_list)
@@ -93,8 +93,8 @@ class QBitArrayIsIterableTest(unittest.TestCase):
anded_qbitarray, anded_bool_list = None, None
try:
anded_qbitarray = self.qbitarray | self.other_qbitarray
- anded_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)]
- except:
+ anded_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)] # noqa: E501
+ except: # noqa: E722
has_and_bitwise_operator = False
self.assertTrue(has_and_bitwise_operator)
self.assertEqual(bool_list_from_qbitarray(anded_qbitarray), anded_bool_list)
@@ -105,8 +105,8 @@ class QBitArrayIsIterableTest(unittest.TestCase):
xored_qbitarray, xored_bool_list = None, None
try:
xored_qbitarray = self.qbitarray | self.other_qbitarray
- xored_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)]
- except:
+ xored_bool_list = [b1 | b2 for b1, b2 in zip(self.qbitarray_values, self.other_qbitarray_values)] # noqa: E501
+ except: # noqa: E722
has_xor_bitwise_operator = False
self.assertTrue(has_xor_bitwise_operator)
self.assertEqual(bool_list_from_qbitarray(xored_qbitarray), xored_bool_list)
diff --git a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
index aa0c84588..64c2a1d69 100644
--- a/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
+++ b/sources/pyside6/tests/QtCore/qbytearray_concatenation_operator_test.py
@@ -29,7 +29,6 @@ class QByteArrayConcatenationOperatorTest(unittest.TestCase):
def testConcatPythonStringAndQByteArray(self):
# Test concatenation of a Python bytes with a QByteArray, in this order
- concat_python_string_add_qbytearray_worked = True
qba = QByteArray(bytes('foo', "UTF-8"))
result = bytes('bar\x00', "UTF-8") + qba
self.assertEqual(type(result), QByteArray)
diff --git a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
index 75fd017e8..873512796 100644
--- a/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
+++ b/sources/pyside6/tests/QtCore/qinstallmsghandler_test.py
@@ -46,7 +46,7 @@ class QInstallMsgHandlerTest(unittest.TestCase):
ret = qInstallMessageHandler(None)
self.assertEqual(ret, None)
refcount = sys.getrefcount(handleruseless)
- retNone = qInstallMessageHandler(handleruseless)
+ retNone = qInstallMessageHandler(handleruseless) # noqa: F841
self.assertEqual(sys.getrefcount(handleruseless), refcount + 1)
rethandler = qInstallMessageHandler(None)
self.assertEqual(rethandler, handleruseless)
@@ -54,7 +54,7 @@ class QInstallMsgHandlerTest(unittest.TestCase):
self.assertEqual(sys.getrefcount(handleruseless), refcount)
def testHandler(self):
- rethandler = qInstallMessageHandler(handler)
+ rethandler = qInstallMessageHandler(handler) # noqa: F841
if QLibraryInfo.isDebugBuild():
qDebug("Test Debug")
self.assertEqual(param[0], QtMsgType.QtDebugMsg)
diff --git a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
index 68e95aa1f..bff586cc2 100644
--- a/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
+++ b/sources/pyside6/tests/QtCore/qmodelindex_internalpointer_test.py
@@ -37,7 +37,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
def testInternalPointer(self):
# Test QAbstractListModel.createIndex and
# QModelIndex.internalPointer with regular Python objects
- obj = QObject()
+ obj = QObject() # noqa: F841
idx = self.model.createIndex(0, 0, "Hello")
i = idx.internalPointer()
self.assertEqual(i, "Hello")
@@ -49,7 +49,7 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
o = [1, 2, 3]
o_refcnt = sys.getrefcount(o)
idx = self.model.createIndex(0, 0, o)
- ptr = idx.internalPointer()
+ ptr = idx.internalPointer() # noqa: F841
self.assertEqual(sys.getrefcount(o), o_refcnt + 1)
def testIndexForDefaultDataArg(self):
diff --git a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
index 6b4e84675..980c766b8 100644
--- a/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
+++ b/sources/pyside6/tests/QtCore/qobject_objectproperty_test.py
@@ -35,7 +35,7 @@ class TestBug378(unittest.TestCase):
'''Test case for the bug #378'''
def testBug378(self):
- obj = ExtQObject()
+ obj = ExtQObject() # noqa: F841
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtCore/qpoint_test.py b/sources/pyside6/tests/QtCore/qpoint_test.py
index ec50cfff2..6af5fc084 100644
--- a/sources/pyside6/tests/QtCore/qpoint_test.py
+++ b/sources/pyside6/tests/QtCore/qpoint_test.py
@@ -19,13 +19,13 @@ from PySide6.QtCore import QPoint, QPointF
class QPointTest(unittest.TestCase):
def testQPointCtor(self):
- point = QPoint(QPoint(10, 20))
+ point = QPoint(QPoint(10, 20)) # noqa: F841
class QPointFTest(unittest.TestCase):
def testQPointFCtor(self):
- pointf = QPointF(QPoint(10, 20))
+ pointf = QPointF(QPoint(10, 20)) # noqa: F841
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtCore/qresource_test.py b/sources/pyside6/tests/QtCore/qresource_test.py
index 5cdc10d25..7c3397c94 100644
--- a/sources/pyside6/tests/QtCore/qresource_test.py
+++ b/sources/pyside6/tests/QtCore/qresource_test.py
@@ -14,7 +14,7 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide6.QtCore import QByteArray, QFile, QIODevice
-import resources_mc
+import resources_mc # noqa: F401
class ResourcesUsage(unittest.TestCase):
diff --git a/sources/pyside6/tests/QtCore/unaryoperator_test.py b/sources/pyside6/tests/QtCore/unaryoperator_test.py
index bbc43c683..5d443e7ca 100644
--- a/sources/pyside6/tests/QtCore/unaryoperator_test.py
+++ b/sources/pyside6/tests/QtCore/unaryoperator_test.py
@@ -42,7 +42,7 @@ class NegUnaryOperatorTest(unittest.TestCase):
__neg__method_exists = True
try:
neg_qpoint = -self.qpoint
- except:
+ except: # noqa: E722
__neg__method_exists = False
self.assertTrue(__neg__method_exists)
diff --git a/sources/pyside6/tests/QtGui/qpen_test.py b/sources/pyside6/tests/QtGui/qpen_test.py
index ae0e14e93..a3328c2e7 100644
--- a/sources/pyside6/tests/QtGui/qpen_test.py
+++ b/sources/pyside6/tests/QtGui/qpen_test.py
@@ -41,7 +41,7 @@ class QPenTest(UsesQApplication):
style = Qt.PenStyle(0)
cap = Qt.PenCapStyle(0)
join = Qt.PenJoinStyle(0)
- pen = QPen(Qt.blue, width, style, cap, join)
+ pen = QPen(Qt.blue, width, style, cap, join) # noqa: F841
def testSetPenWithPenStyleEnum(self):
'''Calls QPainter.setPen with both enum and integer. Bug #511.'''
diff --git a/sources/pyside6/tests/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py
index fbe670e6e..0dcd71064 100644
--- a/sources/pyside6/tests/QtGui/qpixmap_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmap_test.py
@@ -28,7 +28,7 @@ class QPixmapTest(UsesQApplication):
self.assertTrue(pixmap.size().height(), 20)
def testQStringConstructor(self):
- pixmap = QPixmap("Testing!")
+ pixmap = QPixmap("Testing!") # noqa: F841
def testQPixmapLoadFromDataWithQFile(self):
f = QFile(os.path.join(os.path.dirname(__file__), 'sample.png'))
diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
index e18ade7dc..54ad9d7ae 100644
--- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
@@ -31,8 +31,8 @@ class QPixmapCacheTest(UsesQApplication):
pm3 = QPixmap()
ok = QPixmapCache.find('img', pm3)
self.assertTrue(ok)
- b1 = QPixmapCache.find('img').toImage().bits()
- b2 = pm3.toImage().bits()
+ b1 = QPixmapCache.find('img').toImage().bits() # noqa: F841
+ b2 = pm3.toImage().bits() # noqa: F841
self.assertEqual(QPixmapCache.find('img').toImage().bits(), pm3.toImage().bits())
def testWithKey(self):
diff --git a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py
index 123202aa9..683b58256 100644
--- a/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py
+++ b/sources/pyside6/tests/QtGui/qstandarditemmodel_test.py
@@ -67,7 +67,7 @@ class QStandardItemModelRef(UsesQApplication):
for r in range(3):
my_row = model.takeRow(0)
- my_row = None
+ my_row = None # noqa: F841
for c in range(5):
# only rest 1 reference
self.assertEqual(sys.getrefcount(items[r][c]), 2)
diff --git a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
index 91875802c..2c5151724 100644
--- a/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
+++ b/sources/pyside6/tests/QtSvg/qsvgrenderer_test.py
@@ -21,7 +21,7 @@ class QSvgRendererTest(unittest.TestCase):
def testLoad(self):
tigerPath = os.path.join(os.path.dirname(__file__), 'tiger.svg')
- app = QGuiApplication([])
+ app = QGuiApplication([]) # noqa: F841
fromFile = QSvgRenderer(tigerPath)
self.assertTrue(fromFile.isValid())
diff --git a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
index b16815cc7..a1a718733 100644
--- a/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
+++ b/sources/pyside6/tests/QtSvgWidgets/qsvgwidget_test.py
@@ -24,7 +24,7 @@ class QSvgWidgetTest(unittest.TestCase):
tigerPath = QDir.cleanPath(f"{directory}/../QtSvg/tiger.svg")
self.assertTrue(QFileInfo.exists(tigerPath))
- app = QApplication([])
+ app = QApplication([]) # noqa: F841
fromFile = QSvgWidget()
fromFile.load(tigerPath)
self.assertTrue(fromFile.renderer().isValid())
diff --git a/sources/pyside6/tests/QtUiTools/bug_360.py b/sources/pyside6/tests/QtUiTools/bug_360.py
index b374f3ab7..956a7c6b4 100644
--- a/sources/pyside6/tests/QtUiTools/bug_360.py
+++ b/sources/pyside6/tests/QtUiTools/bug_360.py
@@ -38,7 +38,7 @@ class ButTest(UsesQApplication):
loader = MyQUiLoader(w)
filePath = os.path.join(os.path.dirname(__file__), 'minimal.ui')
- ui = loader.load(filePath)
+ ui = loader.load(filePath) # noqa: F841
self.assertEqual(len(loader._widgets), 1)
self.assertEqual(type(loader._widgets[0]), QFrame)
diff --git a/sources/pyside6/tests/QtUiTools/uiloader_test.py b/sources/pyside6/tests/QtUiTools/uiloader_test.py
index 4f58bef73..c1bcf0e81 100644
--- a/sources/pyside6/tests/QtUiTools/uiloader_test.py
+++ b/sources/pyside6/tests/QtUiTools/uiloader_test.py
@@ -41,7 +41,8 @@ class QUiLoaderTester(UsesQApplication):
child = w.findChild(QWidget, "child_object")
self.assertNotEqual(child, None)
- self.assertEqual(w.findChild(QWidget, "grandson_object"), child.findChild(QWidget, "grandson_object"))
+ self.assertEqual(w.findChild(QWidget, "grandson_object"),
+ child.findChild(QWidget, "grandson_object"))
def testLoadFileOverride(self):
# PYSIDE-1070, override QUiLoader::createWidget() with parent=None crashes
diff --git a/sources/pyside6/tests/QtWidgets/bug_480.py b/sources/pyside6/tests/QtWidgets/bug_480.py
index 3e0d34a89..10c19c482 100644
--- a/sources/pyside6/tests/QtWidgets/bug_480.py
+++ b/sources/pyside6/tests/QtWidgets/bug_480.py
@@ -28,7 +28,7 @@ class BuggyWidget(QWidget):
class LayoutTransferOwnerShip(unittest.TestCase):
def testBug(self):
- app = QApplication([])
+ app = QApplication([]) # noqa: F841
w = BuggyWidget()
w.setup()
w.show()
diff --git a/sources/pyside6/tests/QtWidgets/bug_549.py b/sources/pyside6/tests/QtWidgets/bug_549.py
index ad082c451..41e23a7e9 100644
--- a/sources/pyside6/tests/QtWidgets/bug_549.py
+++ b/sources/pyside6/tests/QtWidgets/bug_549.py
@@ -16,7 +16,7 @@ from PySide6.QtWidgets import QApplication, QGraphicsWidget
class TestBug549(unittest.TestCase):
def testBug(self):
- app = QApplication([])
+ app = QApplication([]) # noqa: F841
w = QGraphicsWidget()
w.setContentsMargins(1, 2, 3, 4)
self.assertEqual(w.getContentsMargins(), (1, 2, 3, 4))
diff --git a/sources/pyside6/tests/QtWidgets/bug_575.py b/sources/pyside6/tests/QtWidgets/bug_575.py
index 88d5de9ba..3b2716dda 100644
--- a/sources/pyside6/tests/QtWidgets/bug_575.py
+++ b/sources/pyside6/tests/QtWidgets/bug_575.py
@@ -19,7 +19,7 @@ from PySide6.QtWidgets import QApplication, QPlainTextEdit, QTextEdit
class Bug575(unittest.TestCase):
def testPropertyValues(self):
- app = QApplication(sys.argv)
+ app = QApplication(sys.argv) # noqa: F841
textEdit = QPlainTextEdit()
textEdit.insertPlainText("PySide INdT")
selection = QTextEdit.ExtraSelection()
diff --git a/sources/pyside6/tests/QtWidgets/bug_576.py b/sources/pyside6/tests/QtWidgets/bug_576.py
index 81ebf4f4b..376c15ee8 100644
--- a/sources/pyside6/tests/QtWidgets/bug_576.py
+++ b/sources/pyside6/tests/QtWidgets/bug_576.py
@@ -27,7 +27,7 @@ class Bug576(unittest.TestCase):
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testWidgetParent(self):
self._destroyed = False
- app = QApplication(sys.argv)
+ app = QApplication(sys.argv) # noqa: F841
w = QWidget()
b = QPushButton("test")
diff --git a/sources/pyside6/tests/QtWidgets/bug_585.py b/sources/pyside6/tests/QtWidgets/bug_585.py
index 00abf69a7..dbb64a197 100644
--- a/sources/pyside6/tests/QtWidgets/bug_585.py
+++ b/sources/pyside6/tests/QtWidgets/bug_585.py
@@ -19,11 +19,11 @@ from PySide6.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem
class Bug585(unittest.TestCase):
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testCase(self):
- app = QApplication([])
+ app = QApplication([]) # noqa: F841
self._tree = QTreeWidget()
self._tree.setColumnCount(2)
i1 = QTreeWidgetItem(self._tree, ['1', ])
- i2 = QTreeWidgetItem(self._tree, ['2', ])
+ i2 = QTreeWidgetItem(self._tree, ['2', ]) # noqa: F841
refCount = sys.getrefcount(i1)
# this function return None
diff --git a/sources/pyside6/tests/QtWidgets/bug_674.py b/sources/pyside6/tests/QtWidgets/bug_674.py
index 1262cd150..27a00ad45 100644
--- a/sources/pyside6/tests/QtWidgets/bug_674.py
+++ b/sources/pyside6/tests/QtWidgets/bug_674.py
@@ -18,7 +18,7 @@ class TestBug679(unittest.TestCase):
'''QGraphicsScene::clear() is missing'''
@unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount")
def testIt(self):
- app = QApplication([])
+ app = QApplication([]) # noqa: F841
scene = QGraphicsScene()
hello = scene.addText("Hello")
diff --git a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
index 7a9125844..7bff22778 100644
--- a/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/customproxywidget_test.py
@@ -39,7 +39,7 @@ class CustomProxyWidgetTest(UsesQApplication):
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
- timer = QTimer.singleShot(100, self.app.quit)
+ QTimer.singleShot(100, self.app.quit)
self.app.exec()
diff --git a/sources/pyside6/tests/QtWidgets/keep_reference_test.py b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
index 11f71fe7e..f93770aa0 100644
--- a/sources/pyside6/tests/QtWidgets/keep_reference_test.py
+++ b/sources/pyside6/tests/QtWidgets/keep_reference_test.py
@@ -84,7 +84,7 @@ class KeepReferenceTest(UsesQApplication):
view.setModel(model)
view = QTableView()
createModelAndSetToView(view)
- model = view.model()
+ model = view.model() # noqa: F841
if __name__ == '__main__':
diff --git a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
index 1cf43db73..92dfa871e 100644
--- a/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
+++ b/sources/pyside6/tests/QtWidgets/qgraphicsproxywidget_test.py
@@ -34,7 +34,7 @@ class QGraphicsProxyWidgetTest(UsesQApplication):
view.setViewportUpdateMode(QGraphicsView.BoundingRectViewportUpdate)
view.show()
- timer = QTimer.singleShot(100, self.app.quit)
+ QTimer.singleShot(100, self.app.quit)
self.app.exec()
diff --git a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
index a4ca87758..7d73aca57 100644
--- a/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
+++ b/sources/pyside6/tests/QtWidgets/qmainwindow_test.py
@@ -56,7 +56,7 @@ class TestMainWindow(UsesQApplication):
self.assertEqual(sys.getrefcount(c), 2)
w.setCentralWidget(c)
self.assertEqual(sys.getrefcount(c), 3)
- wr = weakref.ref(c, self.objDel)
+ wr = weakref.ref(c, self.objDel) # noqa: F841
w.setCentralWidget(None)
c = None
self.app.exec()
@@ -73,7 +73,7 @@ class TestMainWindow(UsesQApplication):
w.setCentralWidget(c2)
self.assertEqual(sys.getrefcount(c2), 3)
- wr = weakref.ref(c, self.objDel)
+ wr = weakref.ref(c, self.objDel) # noqa: F841
w.setCentralWidget(None)
c = None
diff --git a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
index ba5e04f1d..bf62e9129 100644
--- a/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
+++ b/sources/pyside6/tests/QtWidgets/qpushbutton_test.py
@@ -34,7 +34,7 @@ class QPushButtonTest(UsesQApplication):
w = MyWidget()
w.show()
- timer = QTimer.singleShot(100, self.app.quit)
+ QTimer.singleShot(100, self.app.quit)
self.app.exec()
def buttonCb(self, checked):
diff --git a/sources/pyside6/tests/util/httpd.py b/sources/pyside6/tests/util/httpd.py
index 925bd1125..4545ef20d 100644
--- a/sources/pyside6/tests/util/httpd.py
+++ b/sources/pyside6/tests/util/httpd.py
@@ -46,7 +46,7 @@ class TestSecureHandler(BaseHTTPServer.BaseHTTPRequestHandler):
try:
handler = self.marshall_handler()
handler.do_request(self)
- except:
+ except: # noqa: E722
self.send_response(401)
self.send_header("WWW-Authenticate", "Basic realm='Secure Area'")
self.send_header("Content-type", "text/plain")
@@ -97,12 +97,12 @@ class CompatTCPServer(SocketServer.TCPServer):
if self.isPy25:
try:
request, client_address = self.get_request()
- except socket.error:
+ except socket.error: # noqa: F821
return
if self.verify_request(request, client_address):
try:
self.process_request(request, client_address)
- except:
+ except: # noqa: E722
self.handle_error(request, client_address)
self.close_request(request)
@@ -138,7 +138,7 @@ class TestServer(threading.Thread):
try:
self.httpd = CompatTCPServer(('', self._port), handle)
break
- except:
+ except: # noqa: E722
self._port = self._port + random.randint(1, 100)
def port(self):