cui/qa/uitest/dialogs/chardlg.py | 1 cui/qa/uitest/dialogs/shortcuts.py | 1 dbaccess/qa/python/fdo84315.py | 3 - pyuno/demo/ooextract.py | 1 pyuno/qa/pytests/testcollections_XCellRange.py | 4 +- pyuno/qa/pytests/testcollections_XEnumerationAccess.py | 4 +- pyuno/qa/pytests/testcollections_XIndexAccess.py | 2 - pyuno/qa/pytests/testcollections_XIndexReplace.py | 2 - pyuno/qa/pytests/testcollections_XNameAccess.py | 12 +++--- pyuno/qa/pytests/testcollections_XNameReplace.py | 4 +- pyuno/qa/pytests/testcollections_misc.py | 2 - pyuno/qa/pytests/testssl.py | 5 ++ sc/qa/uitest/calc_tests4/trackedChanges.py | 2 - sc/workben/cache.py | 3 + sfx2/qa/python/check_sidebar.py | 8 ---- sfx2/qa/python/check_sidebar_registry.py | 2 - sfx2/qa/uitest/doc/objserv.py | 2 - sw/qa/python/check_xtextrangecompare.py | 2 - sw/qa/python/text_portion_enumeration_test.py | 31 +++++++++-------- sw/qa/uitest/librelogo/run.py | 1 sw/qa/uitest/navigator/tdf154521.py | 4 +- sw/qa/uitest/table/splitTable.py | 2 - sw/qa/uitest/ui/frmdlg/frmdlg.py | 2 - sw/qa/uitest/writer_tests7/tdf132714.py | 4 +- sw/qa/uitest/writer_tests7/tdf156783.py | 2 - sw/qa/uitest/writer_tests7/tdf156784.py | 2 - sw/qa/uitest/writer_tests7/tdf156900.py | 2 - sw/qa/uitest/writer_tests8/tdf156243.py | 2 - uitest/ui_logger_dsl/dsl_core.py | 3 + uitest/uitest/test.py | 2 - unotest/source/python/org/libreoffice/unotest.py | 6 --- 31 files changed, 53 insertions(+), 70 deletions(-)
New commits: commit 8b6e0dd9e47c20a79fd194f6d530d1c868911bda Author: Chenxiong Qi <[email protected]> AuthorDate: Sun Dec 17 22:14:09 2023 +0800 Commit: Hossein <[email protected]> CommitDate: Wed Dec 27 13:48:47 2023 +0100 tdf#158803 Fix issues detected by pyflakes Change-Id: Iaa329dff61db894e7d5fecd840e785a53a48b26f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160889 Tested-by: Jenkins Reviewed-by: Hossein <[email protected]> diff --git a/cui/qa/uitest/dialogs/chardlg.py b/cui/qa/uitest/dialogs/chardlg.py index d6ebffac3e1e..6da1e21e2162 100644 --- a/cui/qa/uitest/dialogs/chardlg.py +++ b/cui/qa/uitest/dialogs/chardlg.py @@ -150,7 +150,6 @@ class Test(UITestCase): # Start Writer. with self.ui_test.create_doc_in_start_center("writer"): doc = self.xUITest.getTopFocusWindow() - editWin = doc.getChild("writer_edit") # Use Format -> Character. with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog: diff --git a/cui/qa/uitest/dialogs/shortcuts.py b/cui/qa/uitest/dialogs/shortcuts.py index 99d2bd1ccedc..ac8a0a791496 100644 --- a/cui/qa/uitest/dialogs/shortcuts.py +++ b/cui/qa/uitest/dialogs/shortcuts.py @@ -15,7 +15,6 @@ class Test(UITestCase): def test_tab_navigation(self): with self.ui_test.create_doc_in_start_center("writer"): xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") with self.ui_test.execute_dialog_through_command(".uno:EditStyle") as xDialog: diff --git a/dbaccess/qa/python/fdo84315.py b/dbaccess/qa/python/fdo84315.py index f58b16f51309..680ba7495c3b 100644 --- a/dbaccess/qa/python/fdo84315.py +++ b/dbaccess/qa/python/fdo84315.py @@ -10,7 +10,6 @@ import os import unittest from collections import deque -import unohelper from org.libreoffice.unotest import UnoInProcess class Fdo84315(unittest.TestCase): @@ -67,7 +66,7 @@ class Fdo84315(unittest.TestCase): xResultset = xStatement.executeQuery('SELECT "id" FROM "test_table"') expected_values = deque([0, 1]) - xMeta = self.__test_Query('id', INTEGER, xResultset) + self.__test_Query('id', INTEGER, xResultset) self.__test_ResultSetInteger(xResultset, expected_values) xCon.dispose() diff --git a/pyuno/demo/ooextract.py b/pyuno/demo/ooextract.py index a5699548ce22..0aec00f43a47 100644 --- a/pyuno/demo/ooextract.py +++ b/pyuno/demo/ooextract.py @@ -45,7 +45,6 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], "hc:", ["help", "connection-string=", "html"]) - format = None url = "uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext" filterName = "Text (Encoded)" for o, a in opts: diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py b/pyuno/qa/pytests/testcollections_XCellRange.py index 6ab827ab3346..6ace0b11cba0 100644 --- a/pyuno/qa/pytests/testcollections_XCellRange.py +++ b/pyuno/qa/pytests/testcollections_XCellRange.py @@ -230,9 +230,9 @@ class TestXCellRange(CollectionsTestBase): # When / Then with self.assertRaises(KeyError): - rng = sht[1:1, 3:5] + _ = sht[1:1, 3:5] with self.assertRaises(KeyError): - rng = sht[1:3, 3:3] + _ = sht[1:3, 3:3] spr.close(True) diff --git a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py index 385514ae77c5..eecb81c05021 100644 --- a/pyuno/qa/pytests/testcollections_XEnumerationAccess.py +++ b/pyuno/qa/pytests/testcollections_XEnumerationAccess.py @@ -127,13 +127,13 @@ class TestXEnumerationAccess(CollectionsTestBase): # if val in obj: ... # Test value presence # For: # Invalid value (dict) - def test_XEnumerationAccess_IfIn_String(self): + def test_XEnumerationAccess_IfIn_String_TypeError(self): # Given doc = self.createBlankTextDocument() # When / Then with self.assertRaises(TypeError): - result = {} in doc.Text + _ = {} in doc.Text doc.close(True) diff --git a/pyuno/qa/pytests/testcollections_XIndexAccess.py b/pyuno/qa/pytests/testcollections_XIndexAccess.py index ee668b7bfb4c..07c14c1b0942 100644 --- a/pyuno/qa/pytests/testcollections_XIndexAccess.py +++ b/pyuno/qa/pytests/testcollections_XIndexAccess.py @@ -223,7 +223,7 @@ class TestXIndexAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - present = {} in doc.Footnotes + _ = {} in doc.Footnotes doc.close(True); diff --git a/pyuno/qa/pytests/testcollections_XIndexReplace.py b/pyuno/qa/pytests/testcollections_XIndexReplace.py index b2b2d2245750..0075883543d3 100644 --- a/pyuno/qa/pytests/testcollections_XIndexReplace.py +++ b/pyuno/qa/pytests/testcollections_XIndexReplace.py @@ -177,7 +177,6 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceSlice(self): assign_max = 12 doc = self.createBlankTextDocument() - t = tuple(range(10)) for j in [x for x in range(-12, 13)] + [None]: for k in [x for x in range(-12, 13)] + [None]: key = slice(j, k) @@ -218,7 +217,6 @@ class TestXIndexReplace(CollectionsTestBase): def test_XIndexReplace_ReplaceExtendedSlice(self): assign_max = 12 doc = self.createBlankTextDocument() - t = tuple(range(10)) for j in [x for x in range(-12, 13)] + [None]: for k in [x for x in range(-12, 13)] + [None]: for l in [-2, -1, 2]: diff --git a/pyuno/qa/pytests/testcollections_XNameAccess.py b/pyuno/qa/pytests/testcollections_XNameAccess.py index 5c5ad6890be2..155029b9fadf 100644 --- a/pyuno/qa/pytests/testcollections_XNameAccess.py +++ b/pyuno/qa/pytests/testcollections_XNameAccess.py @@ -66,7 +66,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(KeyError): - link = drw.Links['Slide'].Links['foo'] + _ = drw.Links['Slide'].Links['foo'] drw.close(True) @@ -80,7 +80,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[None] + _ = drw.Links[None] drw.close(True) @@ -94,7 +94,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[12.34] + _ = drw.Links[12.34] drw.close(True) @@ -108,7 +108,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[(1, 2)] + _ = drw.Links[(1, 2)] drw.close(True) @@ -122,7 +122,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[[1, 2]] + _ = drw.Links[[1, 2]] drw.close(True) @@ -136,7 +136,7 @@ class TestXNameAccess(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - link = drw.Links[{'a': 'b'}] + _ = drw.Links[{'a': 'b'}] drw.close(True) diff --git a/pyuno/qa/pytests/testcollections_XNameReplace.py b/pyuno/qa/pytests/testcollections_XNameReplace.py index a0be04404f09..e93ca590e51d 100644 --- a/pyuno/qa/pytests/testcollections_XNameReplace.py +++ b/pyuno/qa/pytests/testcollections_XNameReplace.py @@ -45,7 +45,7 @@ class TestXNameReplace(CollectionsTestBase): # obj[key] = val # Replace by key # For: # Invalid key - def test_XNameReplace_ReplaceName_Invalid(self): + def test_XNameReplace_ReplaceName_Invalid_Key(self): # Given doc = self.createBlankTextDocument() event_properties = (PropertyValue(Name='Script', Value=getScriptName()),) @@ -60,7 +60,7 @@ class TestXNameReplace(CollectionsTestBase): # obj[key] = val # Replace by key # For: # Invalid key type - def test_XNameReplace_ReplaceName_Invalid(self): + def test_XNameReplace_ReplaceName_Invalid_Key_Type(self): # Given doc = self.createBlankTextDocument() event_properties = (PropertyValue(Name='Script', Value=getScriptName()),) diff --git a/pyuno/qa/pytests/testcollections_misc.py b/pyuno/qa/pytests/testcollections_misc.py index 7ca40de1f7ad..e32815840749 100644 --- a/pyuno/qa/pytests/testcollections_misc.py +++ b/pyuno/qa/pytests/testcollections_misc.py @@ -42,7 +42,7 @@ class TestMisc(CollectionsTestBase): # When / Then with self.assertRaises(TypeError): - foo = "bar" in doc.UIConfigurationManager + _ = "bar" in doc.UIConfigurationManager doc.close(True) diff --git a/pyuno/qa/pytests/testssl.py b/pyuno/qa/pytests/testssl.py index 6ec9875fb84f..d29066ffe39e 100644 --- a/pyuno/qa/pytests/testssl.py +++ b/pyuno/qa/pytests/testssl.py @@ -1,3 +1,4 @@ +import os import unittest @@ -6,5 +7,9 @@ class SSLTest(unittest.TestCase): def test_ssl_import(self): import ssl + # use imported ssl module for pyflakes + with open(os.devnull, "w") as devnull: + print(str(ssl), file=devnull) + if __name__ == '__main__': unittest.main() diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py index 0f38f9f3042c..5ad8c3f3a9d2 100644 --- a/sc/qa/uitest/calc_tests4/trackedChanges.py +++ b/sc/qa/uitest/calc_tests4/trackedChanges.py @@ -96,7 +96,7 @@ class CalcTrackedChanges(UITestCase): def test_Tdf153096(self): - with self.ui_test.create_doc_in_start_center("calc") as document: + with self.ui_test.create_doc_in_start_center("calc"): self.ui_test.wait_until_child_is_available("grid_window") xCalcDoc = self.xUITest.getTopFocusWindow() gridwin = xCalcDoc.getChild("grid_window") diff --git a/sc/workben/cache.py b/sc/workben/cache.py index ba96abe9758b..982d80c510d3 100644 --- a/sc/workben/cache.py +++ b/sc/workben/cache.py @@ -51,7 +51,8 @@ def parse_block(data, index): def parse_column(data, index): - column_index = struct.unpack('Q', data[index:index+8])[0] + # get the column index + struct.unpack('Q', data[index:index+8])[0] index += 8 column_entries = struct.unpack('Q', data[index:index+8])[0] index += 8 diff --git a/sfx2/qa/python/check_sidebar.py b/sfx2/qa/python/check_sidebar.py index 59cc955b8016..7f188baa4ba7 100644 --- a/sfx2/qa/python/check_sidebar.py +++ b/sfx2/qa/python/check_sidebar.py @@ -8,15 +8,8 @@ # import unittest -import unohelper -import os from org.libreoffice.unotest import UnoInProcess -from com.sun.star.ui import XSidebarProvider -from com.sun.star.ui import XDecks -from com.sun.star.ui import XDeck -from com.sun.star.ui import XPanels -from com.sun.star.ui import XPanel class CheckSidebar(unittest.TestCase): @@ -38,7 +31,6 @@ class CheckSidebar(unittest.TestCase): assert(xSidebar) xSidebar.setVisible(True) - isVisible = xSidebar.isVisible() self.assertTrue ( xSidebar.isVisible() ) # TODO: does not work in unit test context diff --git a/sfx2/qa/python/check_sidebar_registry.py b/sfx2/qa/python/check_sidebar_registry.py index 47b8eecdefb9..bc247006ccc0 100644 --- a/sfx2/qa/python/check_sidebar_registry.py +++ b/sfx2/qa/python/check_sidebar_registry.py @@ -8,8 +8,6 @@ # import unittest -import unohelper -import os from org.libreoffice.unotest import UnoInProcess import uno diff --git a/sfx2/qa/uitest/doc/objserv.py b/sfx2/qa/uitest/doc/objserv.py index 627469ae9323..f67198bd1607 100644 --- a/sfx2/qa/uitest/doc/objserv.py +++ b/sfx2/qa/uitest/doc/objserv.py @@ -13,7 +13,7 @@ class Test(UITestCase): def testPdfSigning(self): # Start Impress. - with self.ui_test.load_file(get_url_for_data_file("pdf-sign.pdf")) as impress_doc: + with self.ui_test.load_file(get_url_for_data_file("pdf-sign.pdf")): # Now use File -> Digital signatures -> Digital signatures. with self.ui_test.execute_dialog_through_command(".uno:Signature", close_button="close"): diff --git a/sw/qa/python/check_xtextrangecompare.py b/sw/qa/python/check_xtextrangecompare.py index 181e97ff6b2e..44eb691f4518 100644 --- a/sw/qa/python/check_xtextrangecompare.py +++ b/sw/qa/python/check_xtextrangecompare.py @@ -80,7 +80,7 @@ class XTextRangeCompare(unittest.TestCase): xDoc.close(True) - def test_compareRegionStarts_DiffSelection(self): + def test_compareRegionStarts_SameSelection(self): xDoc = self._uno.openEmptyWriterDoc() cursor1 = xDoc.Text.createTextCursor() diff --git a/sw/qa/python/text_portion_enumeration_test.py b/sw/qa/python/text_portion_enumeration_test.py index c183aaf41b09..0a064f544cf5 100644 --- a/sw/qa/python/text_portion_enumeration_test.py +++ b/sw/qa/python/text_portion_enumeration_test.py @@ -918,6 +918,10 @@ class FuzzyTester(): print("unexpected node: {}".format(str(node))) +def SoftPageBreakNode(): + raise NotImplementedError("todo") + + class TextPortionEnumerationTest(unittest.TestCase): xMSF = None @@ -963,7 +967,7 @@ class TextPortionEnumerationTest(unittest.TestCase): @unittest.skip("FIXME: insert a soft page break: not done") def test_soft_page_break(self): root = TreeNode() - spbk =SoftPageBreakNode() + spbk = SoftPageBreakNode() text = TextNode("abc") root.appendchild(spbk) root.appendchild(text) @@ -2119,7 +2123,7 @@ class TextPortionEnumerationTest(unittest.TestCase): met2 = MetaNode(self.mkid("id")) try: inserter.insertrange(Range(0, 4, met2)) - fail("testRangeMetaMeta: overlap left allowed") + self.fail("testRangeMetaMeta: overlap left allowed") except IllegalArgumentException: pass root = TreeNode() @@ -2535,7 +2539,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta1.setParent(xMeta4) - fail("setParent(): allowed?") + self.fail("setParent(): allowed?") except NoSupportException: pass self.assertIsNone(xMeta1.getParent(), "getParent(): not None") @@ -2592,7 +2596,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.createTextCursorByRange(None) - fail("createTextCursorByRange(): None allowed?") + self.fail("createTextCursorByRange(): None allowed?") except RuntimeException: pass @@ -2609,13 +2613,13 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.insertString(None, "foo", False) - fail("insertString(): None allowed?") + self.fail("insertString(): None allowed?") except RuntimeException: pass try: xMeta.insertString(xDocTextCursor, "foo", False) - fail("insertString(): cursor outside allowed?") + self.fail("insertString(): cursor outside allowed?") except RuntimeException: pass @@ -2630,14 +2634,14 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.insertControlCharacter(None, HARD_HYPHEN, False) - fail("insertControlCharacter(): None allowed?") + self.fail("insertControlCharacter(): None allowed?") except IllegalArgumentException: pass xStart = xMeta.getStart() try: xMeta.insertControlCharacter(xDocTextCursor, HARD_HYPHEN, False) - fail("insertControlCharacter(): cursor outside allowed?") + self.fail("insertControlCharacter(): cursor outside allowed?") except IllegalArgumentException: pass @@ -2654,19 +2658,19 @@ class TextPortionEnumerationTest(unittest.TestCase): xMeta.setString("45") try: xMeta.insertTextContent(None, xMeta, False) - fail("insertTextContent(): None range allowed?") + self.fail("insertTextContent(): None range allowed?") except IllegalArgumentException: pass try: xMeta.insertTextContent(xStart, None, False) - fail("insertTextContent(): None content allowed?") + self.fail("insertTextContent(): None content allowed?") except IllegalArgumentException: pass try: xMeta.insertTextContent(xDocTextCursor, xMeta, False) - fail("insertTextContent(): cursor outside allowed?") + self.fail("insertTextContent(): cursor outside allowed?") except IllegalArgumentException: pass @@ -2699,7 +2703,7 @@ class TextPortionEnumerationTest(unittest.TestCase): try: xMeta.removeTextContent(None) - fail("removeTextContent(): None content allowed?") + self.fail("removeTextContent(): None content allowed?") except RuntimeException: pass @@ -2775,7 +2779,6 @@ class TextPortionEnumerationTest(unittest.TestCase): ## XTextCursor xMetaCursor = xMeta.createTextCursor() self.assertIsNotNone(xMetaCursor, "createTextCursor(): no cursor") - bSuccess = False xMetaCursor.gotoStart(False) xMetaCursor.gotoEnd(False) bSuccess = xMetaCursor.goLeft(1, False) @@ -2790,7 +2793,7 @@ class TextPortionEnumerationTest(unittest.TestCase): xMetaCursor.gotoRange(xEnd, False) try: xMetaCursor.gotoRange(xDocTextCursor, False) - fail("gotoRange(): succeeded") + self.fail("gotoRange(): succeeded") except RuntimeException: pass diff --git a/sw/qa/uitest/librelogo/run.py b/sw/qa/uitest/librelogo/run.py index 54e003216015..4c5c13549184 100644 --- a/sw/qa/uitest/librelogo/run.py +++ b/sw/qa/uitest/librelogo/run.py @@ -9,7 +9,6 @@ from uitest.framework import UITestCase from uitest.uihelper.common import type_text -from com.sun.star.awt.FontSlant import NONE as __Slant_NONE__ from com.sun.star.awt.FontSlant import ITALIC as __Slant_ITALIC__ from com.sun.star.awt.FontUnderline import NONE as __Underline_NONE__ from com.sun.star.awt.FontUnderline import SINGLE as __Underline_SINGLE__ diff --git a/sw/qa/uitest/navigator/tdf154521.py b/sw/qa/uitest/navigator/tdf154521.py index 048efb0212c2..65a86e7be613 100644 --- a/sw/qa/uitest/navigator/tdf154521.py +++ b/sw/qa/uitest/navigator/tdf154521.py @@ -128,9 +128,9 @@ class tdf154521(UITestCase): xWriterEdit.executeAction("FOCUS", tuple()) - xContentTree = xNavigatorPanel.getChild("contenttree") - # disable flakey UITest +# xContentTree = xNavigatorPanel.getChild("contenttree") + # self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "Bookmark 1") # self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 1") # self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py index 0292c452b187..06af8ee6c89d 100644 --- a/sw/qa/uitest/table/splitTable.py +++ b/sw/qa/uitest/table/splitTable.py @@ -65,7 +65,7 @@ class splitTable(UITestCase): self.assertEqual(writer_doc.TextTables.getCount(), 1) def test_tdf115572_remember_split_table_option(self): - with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")): # Go to second row self.xUITest.executeCommand(".uno:GoDown") self.xUITest.executeCommand(".uno:GoDown") diff --git a/sw/qa/uitest/ui/frmdlg/frmdlg.py b/sw/qa/uitest/ui/frmdlg/frmdlg.py index 36de1876bdd9..f7e91269c299 100644 --- a/sw/qa/uitest/ui/frmdlg/frmdlg.py +++ b/sw/qa/uitest/ui/frmdlg/frmdlg.py @@ -105,7 +105,7 @@ class Test(UITestCase): def test_insert_simple_frame(self): # Given a Writer document: - with self.ui_test.create_doc_in_start_center("writer") as xComponent: + with self.ui_test.create_doc_in_start_center("writer"): # When inserting a simple text frame (not a floating table): with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialog: to_char = xDialog.getChild("tochar") diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py index cad8ff24e80d..d2a71587ed77 100644 --- a/sw/qa/uitest/writer_tests7/tdf132714.py +++ b/sw/qa/uitest/writer_tests7/tdf132714.py @@ -14,7 +14,7 @@ from com.sun.star.awt import MouseEvent class tdf132714(UITestCase): def test_tdf132714(self): - with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document: + with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")): # delete second row (first data row) in the associated text table of the chart self.xUITest.executeCommand(".uno:GoDown") @@ -90,7 +90,7 @@ class tdf132714(UITestCase): xSeriesObj = xChartMain.getChild("CID/Page=") # Without the fix in place, this test would have crashed here - with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})): pass diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py b/sw/qa/uitest/writer_tests7/tdf156783.py index 2ccdb7dcf6e1..100d816541e1 100644 --- a/sw/qa/uitest/writer_tests7/tdf156783.py +++ b/sw/qa/uitest/writer_tests7/tdf156783.py @@ -18,8 +18,6 @@ class tdf156783(UITestCase): def test_tdf156783(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py b/sw/qa/uitest/writer_tests7/tdf156784.py index 5cac8fc628db..fa522212a8b0 100644 --- a/sw/qa/uitest/writer_tests7/tdf156784.py +++ b/sw/qa/uitest/writer_tests7/tdf156784.py @@ -15,8 +15,6 @@ class tdf156784(UITestCase): def test_tdf156784(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests7/tdf156900.py b/sw/qa/uitest/writer_tests7/tdf156900.py index 545be94242f4..945d91aef365 100644 --- a/sw/qa/uitest/writer_tests7/tdf156900.py +++ b/sw/qa/uitest/writer_tests7/tdf156900.py @@ -15,8 +15,6 @@ class tdf156900(UITestCase): def test_tdf156900(self): with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document: - xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') - # accept all tracked changes self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges") diff --git a/sw/qa/uitest/writer_tests8/tdf156243.py b/sw/qa/uitest/writer_tests8/tdf156243.py index 461c9b508b86..522c7f1253e6 100644 --- a/sw/qa/uitest/writer_tests8/tdf156243.py +++ b/sw/qa/uitest/writer_tests8/tdf156243.py @@ -27,7 +27,7 @@ class tdf156243(UITestCase): self.assertEqual(enabled, get_state_as_dict(xCheckbox)["IsChecked"]) def test_tdf156243_Autocorrect_dialog(self): - with self.ui_test.create_doc_in_start_center("writer") as document: + with self.ui_test.create_doc_in_start_center("writer"): xWriterDoc = self.xUITest.getTopFocusWindow() xWriterEdit = xWriterDoc.getChild("writer_edit") try: diff --git a/uitest/ui_logger_dsl/dsl_core.py b/uitest/ui_logger_dsl/dsl_core.py index 77c75eae9bf3..798dc43256e9 100644 --- a/uitest/ui_logger_dsl/dsl_core.py +++ b/uitest/ui_logger_dsl/dsl_core.py @@ -1072,7 +1072,8 @@ class ul_Compiler: self.output_stream.write(str(line)) def do_nothing(self, Command): - line = "to be added in the future" + # to be added in the future + pass def __del__(self): self.output_stream.close() diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index db2bc1828be1..7d867a14da68 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -212,7 +212,7 @@ class UITest(object): component.dispose() else: if component.isModified(): - with self.execute_dialog_through_command('.uno:CloseDoc', close_button="discard") as xConfirmationDialog: + with self.execute_dialog_through_command('.uno:CloseDoc', close_button="discard"): pass else: self._xUITest.executeCommand(".uno:CloseDoc") diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py index e27f9e145de4..743e1781de84 100644 --- a/unotest/source/python/org/libreoffice/unotest.py +++ b/unotest/source/python/org/libreoffice/unotest.py @@ -35,11 +35,6 @@ except ImportError: print(" URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise -try: - from urllib.parse import quote -except ImportError: - from urllib import quote - ### utilities ### def mkPropertyValue(name, value): @@ -314,6 +309,7 @@ if __name__ == "__main__": args = parser.parse_args() if args.verbose: verbose = True + from uitest.libreoffice.connection import PersistentConnection con = PersistentConnection({"verbose" : args.verbose}) print("starting soffice ... ", end="") con.setUp()
