Skip to content

Commit 0904968

Browse files
Cleaning (#2556)
* Reduce warnings in utest * Dev version
1 parent 2a98ebf commit 0904968

39 files changed

+571
-484
lines changed

src/robotide/action/actioninfo.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def position(self):
254254
return int(self._position.split("POSITION-")[-1])
255255
return -1
256256

257+
257258
class SeparatorInfo(MenuInfo):
258259
"""Used to create separators to menus."""
259260

@@ -273,7 +274,7 @@ def is_separator(self):
273274

274275

275276
class _InsertionPoint(object):
276-
_shortcut_remover = re.compile(' {2,}\([^()]+\)$')
277+
_shortcut_remover = re.compile(r" {2,}\([^()]+\)$")
277278

278279
def __init__(self, before=None, after=None):
279280
self._item = before or after

src/robotide/contrib/testrunner/usages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
try:
2020
from robotide.lib.robot.run import USAGE # Then try the provided version, 3.1.2
2121
except ImportError:
22-
USAGE = """\
22+
USAGE = """
2323
Robot Framework -- A generic test automation framework
2424
2525
Usage: robot|jybot|irobot [options] data_sources
@@ -313,7 +313,7 @@
313313
all given arguments, incl. data sources, are escaped
314314
so escape characters ought to be selected carefully.
315315
Available escapes: amp (&), apos ('), at (@), bslash
316-
(\), colon (:), comma (,), curly1 ({), curly2 (}),
316+
(\\), colon (:), comma (,), curly1 ({), curly2 (}),
317317
dollar ($), exclam (!), gt (>), hash (#), lt (<),
318318
paren1 ((), paren2 ()), percent (%), pipe (|), quest
319319
(?), quot ("), semic (;), slash (/), space ( ),

src/robotide/controller/filecontrollers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ def is_inside_top_suite(self, res):
400400

401401

402402
class TestDataDirectoryController(_DataController, _FileSystemElement, _BaseController):
403+
__test__ = False
403404

404405
def __init__(self, data, project=None, parent=None):
405406
dir_ = data.directory
@@ -684,6 +685,7 @@ class DirtyRobotDataException(Exception):
684685

685686

686687
class TestCaseFileController(_FileSystemElement, _DataController):
688+
__test__ = False
687689

688690
def __init__(self, data, project=None, parent=None):
689691
_FileSystemElement.__init__(self, data.source if data else None, data.directory)

src/robotide/controller/macrocontrollers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class KeywordNameController(ItemNameController):
7070

7171

7272
class TestCaseNameController(ItemNameController):
73+
__test__ = False
7374
_name_field = TESTCASE_NAME_FIELD
7475

7576

@@ -308,6 +309,7 @@ def _notify(self, messageclass):
308309

309310

310311
class TestCaseController(_WithStepsController):
312+
__test__ = False
311313

312314
_populator = robotapi.TestCasePopulator
313315
filename = ""

src/robotide/controller/tablecontrollers.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from .settingcontrollers import MetadataController, ImportController, VariableController
2525

2626

27-
class _WithListOperations(object):
27+
class WithListOperations(object):
2828

2929
def move_up(self, index):
3030
if index > 0:
@@ -72,7 +72,7 @@ def _index_difference(self, original_list, sorted_list):
7272
return index_difference
7373

7474

75-
class VariableTableController(_TableController, _WithListOperations):
75+
class VariableTableController(_TableController, WithListOperations):
7676

7777
def __init__(self, parent_controller, table):
7878
_TableController.__init__(self, parent_controller, table)
@@ -100,7 +100,7 @@ def move_up(self, index):
100100
if index == 0:
101101
return False
102102
ctrl = self[index]
103-
_WithListOperations.move_up(self, index)
103+
WithListOperations.move_up(self, index)
104104
other = self[index]
105105
self.mark_dirty()
106106
RideVariableMovedUp(item=ctrl, other=other).publish()
@@ -109,7 +109,7 @@ def move_down(self, index):
109109
if index + 1 == len(self._items):
110110
return False
111111
ctrl = self[index]
112-
_WithListOperations.move_down(self, index)
112+
WithListOperations.move_down(self, index)
113113
other = self[index]
114114
self.mark_dirty()
115115
RideVariableMovedDown(item=ctrl, other=other).publish()
@@ -316,6 +316,7 @@ def _configure_controller(self, ctrl, config):
316316

317317

318318
class TestCaseTableController(_MacroTable):
319+
__test__ = False
319320
item_type = 'Test case'
320321
_controller_class = macrocontrollers.TestCaseController
321322

@@ -385,7 +386,7 @@ def restore_keyword_order(self, list):
385386
self._table.keywords = keywords_temp
386387

387388

388-
class ImportSettingsController(_TableController, _WithListOperations):
389+
class ImportSettingsController(_TableController, WithListOperations):
389390

390391
def __init__(self, parent_controller, table, resource_file_controller_factory=None):
391392
_TableController.__init__(self, parent_controller, table)
@@ -415,18 +416,18 @@ def _items(self):
415416
def resource_file_controller_factory(self):
416417
return self._resource_file_controller_factory
417418

418-
@overrides(_WithListOperations)
419+
@overrides(WithListOperations)
419420
def _swap(self, ind1, ind2):
420421
imps = self._import_controllers
421422
imps[ind1], imps[ind2] = imps[ind2], imps[ind1]
422-
_WithListOperations._swap(self, ind1, ind2)
423+
WithListOperations._swap(self, ind1, ind2)
423424

424425
def remove_import_data(self, imp):
425426
self.delete(self._items.data.index(imp))
426427

427428
def delete(self, index):
428429
item = self[index]
429-
_WithListOperations.delete(self, index)
430+
WithListOperations.delete(self, index)
430431
self._import_controllers.pop(index)
431432
item.publish_removed()
432433
self.notify_imports_modified()
@@ -469,7 +470,7 @@ def resource_import_modified(self, path):
469470
return self._parent.resource_import_modified(path)
470471

471472

472-
class MetadataListController(_TableController, _WithListOperations):
473+
class MetadataListController(_TableController, WithListOperations):
473474

474475
def __iter__(self):
475476
return iter(MetadataController(self, m) for m in self._items)

src/robotide/controller/testexecutionresults.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919

2020
class TestExecutionResults(object):
21+
__test__ = False
2122
RUNNING = 'Running'
2223
STOPPED = 'Stopped'
2324
PASSED = 'Passed'

src/robotide/controller/ui/treecontroller.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,25 @@ def register_tree_actions(self):
4949
action=self.OnClearSelected))
5050

5151
def OnGoBack(self, event):
52+
_ = event
5253
node = self._history.back()
5354
if node:
5455
self._tree.SelectItem(node)
5556

5657
def OnAddTagToSelected(self, event):
58+
_ = event
5759
if self._test_selection.is_empty():
5860
return
5961
name = wx.GetTextFromUser(message='Enter Tag Name', caption='Add Tag To Selected')
6062
if name:
6163
self._test_selection.add_tag(name)
6264

6365
def OnClearSelected(self, event):
66+
_ = event
6467
self._test_selection.clear_all(message=None)
6568

6669
def OnGoForward(self, event):
70+
_ = event
6771
node = self._history.forward()
6872
if node:
6973
self._tree.SelectItem(node)
@@ -181,6 +185,7 @@ def clear(self):
181185

182186

183187
class TestSelectionController(object):
188+
__test__ = False
184189

185190
def __init__(self):
186191
self._tests: {TestCaseController} = set()
@@ -192,6 +197,7 @@ def is_test_selected(self, test):
192197
return test in self._tests
193198

194199
def clear_all(self, message):
200+
_ = message
195201
self._tests = set()
196202
self._send_selection_changed_message()
197203

@@ -241,5 +247,6 @@ def _move_default_tags_to_test(self, test):
241247
if isinstance(tag, DefaultTag):
242248
self._add_tag(test, tag.name)
243249

244-
def _add_tag(self, test, name):
250+
@staticmethod
251+
def _add_tag(test, name):
245252
test.tags.execute(ctrlcommands.ChangeTag(Tag(None), name))

src/robotide/editor/dialoghelps.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,18 @@ def get_help(title):
2020

2121
_HELPS = {}
2222
_EXAMPLES = {
23-
'ESCAPE': "Possible pipes in the value must be escaped with a backslash like '\|'.",
24-
'TAG': "Separate tags with a pipe character like 'tag | second tag | 3rd'.",
25-
'FIXTURE': "Separate possible arguments with a pipe character like 'My Keyword | arg 1 | arg 2'.",
26-
'TIMEOUT': ("Use time syntax like '1min 10s' or '2 hours' or give the value as seconds.\n"
27-
"Optional message can be specified like '3 minutes | My message here'."),
28-
'ARGUMENTS': ("Specify the arguments separated with a pipe character like '${arg1} | ${arg2}'.\n"
29-
"Default values are given using equal sign and the last argument can be a list variable.\n"
30-
"Example: '${arg1} | ${arg2}=default value | @{rest}'.\n"
31-
"Note. You can use variable shortcuts in this field.")
23+
'ESCAPE': "Possible pipes in the value must be escaped with a backslash like '\\|'.",
24+
'TAG': "Separate tags with a pipe character like 'tag | second tag | 3rd'.",
25+
'FIXTURE': "Separate possible arguments with a pipe character like 'My Keyword | arg 1 | arg 2'.",
26+
'TIMEOUT': ("Use time syntax like '1min 10s' or '2 hours' or give the value as seconds.\n"
27+
"Optional message can be specified like '3 minutes | My message here'."),
28+
'ARGUMENTS': ("Specify the arguments separated with a pipe character like '${arg1} | ${arg2}'.\n"
29+
"Default values are given using equal sign and the last argument can be a list variable.\n"
30+
"Example: '${arg1} | ${arg2}=default value | @{rest}'.\n"
31+
"Note. You can use variable shortcuts in this field.")
3232
}
3333

34+
current = None
3435
for row in """
3536
Scalar Variable
3637
Give name and value of the variable.

src/robotide/editor/editordialogs.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def _add_comment_editor(self, item):
6060
self._sizer.Add(self._comment_editor)
6161

6262
def _create_line(self):
63-
line = wx.StaticLine(self, size=(20,-1), style=wx.LI_HORIZONTAL)
63+
line = wx.StaticLine(self, size=(20, -1), style=wx.LI_HORIZONTAL)
6464
if wx.VERSION < (4, 1, 0):
6565
self._sizer.Add(line, 0, wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT | wx.TOP, 5)
6666
else:
@@ -71,7 +71,7 @@ def _create_help(self):
7171
flag=wx.ALL, border=2)
7272

7373
def _create_buttons(self, **kwargs):
74-
buttons = self.CreateStdDialogButtonSizer(wx.OK|wx.CANCEL)
74+
buttons = self.CreateStdDialogButtonSizer(wx.OK | wx.CANCEL)
7575
self.SetBackgroundColour(Colour(self.color_background))
7676
self.SetForegroundColour(Colour(self.color_foreground))
7777
for item in self.GetChildren():
@@ -80,10 +80,10 @@ def _create_buttons(self, **kwargs):
8080
item.SetOwnBackgroundColour(Colour(self.color_secondary_background))
8181
item.SetForegroundColour(Colour(self.color_secondary_foreground))
8282
item.SetOwnForegroundColour(Colour(self.color_secondary_foreground))
83-
self._sizer.Add(buttons, 0, wx.ALIGN_CENTER|wx.ALL, 5)
83+
self._sizer.Add(buttons, 0, wx.ALIGN_CENTER | wx.ALL, 5)
8484

8585
def get_value(self):
86-
return [ e.get_value() for e in self._editors ]
86+
return [e.get_value() for e in self._editors]
8787

8888
def get_comment(self):
8989
return self._comment_editor.get_value()
@@ -251,11 +251,15 @@ def _execute(self):
251251

252252

253253
class TestSetupDialog(_FixtureDialog):
254+
__test__ = False
255+
254256
def _execute(self):
255257
pass
256258

257259

258260
class TestTeardownDialog(_FixtureDialog):
261+
__test__ = False
262+
259263
def _execute(self):
260264
pass
261265

@@ -276,6 +280,8 @@ def _execute(self):
276280

277281

278282
class TestTemplateDialog(_FixtureDialog):
283+
__test__ = False
284+
279285
def _execute(self):
280286
pass
281287

@@ -294,6 +300,7 @@ def _execute(self):
294300

295301

296302
class TestTimeoutDialog(_SettingDialog):
303+
__test__ = False
297304
_validator = TimeoutValidator
298305

299306
def _execute(self):
@@ -317,6 +324,7 @@ def _execute(self):
317324

318325

319326
class TestCaseNameDialog(_Dialog):
327+
__test__ = False
320328
_title = 'New Test Case'
321329

322330
def _add_comment_editor(self, item):

src/robotide/editor/editors.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def __init__(self, plugin, parent, controller, tree):
9090
0, wx.EXPAND | wx.ALL, 5)
9191
# self.sizer.Add((0, 10)) # DEBUG why this?
9292
self._editors = []
93+
self._last_shown_tooltip = None
9394
self._reset_last_show_tooltip()
9495
self._populate()
9596
self.plugin.subscribe(self._settings_changed, RideItemSettingsChanged)
@@ -109,6 +110,7 @@ def _settings_changed(self, message):
109110
editor.update_value()
110111

111112
def OnIdle(self, event):
113+
_ = event
112114
if self._last_shown_tooltip and self._mouse_outside_tooltip():
113115
self._last_shown_tooltip.hide()
114116
self._reset_last_show_tooltip()
@@ -247,7 +249,8 @@ def create_editor_for(self, controller, plugin, tree):
247249
editor_cls = self._get_editor_class(controller)
248250
return editor_cls(self.GetPane(), controller, plugin, tree)
249251

250-
def _get_editor_class(self, controller):
252+
@staticmethod
253+
def _get_editor_class(controller):
251254
if isinstance(controller, DocumentationController):
252255
return DocumentationEditor
253256
if isinstance(controller, TagsController):
@@ -300,9 +303,11 @@ def __init__(self, *args):
300303
self._update_source_and_name, RideFileNameChanged)
301304

302305
def _update_source(self, message=None):
306+
_ = message
303307
self._source.SetValue(self.controller.data.source)
304308

305309
def _update_source_and_name(self, message):
310+
_ = message
306311
self._title_display.SetLabel(self.controller.name)
307312
self._update_source()
308313

@@ -377,13 +382,15 @@ def _create_header(self, text, readonly=False):
377382
text += ' (READ ONLY)'
378383

379384
def cb(event):
385+
_ = event
380386
ResourceFileUsages(self.controller, self._tree.highlight).show()
381387
self._title_display = FindUsagesHeader(self, text, cb, color_foreground=self.color_secondary_foreground,
382388
color_background=self.color_secondary_background)
383389
return self._title_display
384390

385391

386392
class TestCaseFileEditor(_FileEditor):
393+
__test__ = False
387394
_settings_open_id = 'test case file settings open'
388395

389396
def _populate(self):
@@ -405,6 +412,7 @@ def _populate(self):
405412
self.plugin.subscribe(self._init_file_removed, RideInitFileRemoved)
406413

407414
def _init_file_removed(self, message):
415+
_ = message
408416
for setting, editor in zip(self.controller.settings, self._editors):
409417
editor.refresh(setting)
410418

0 commit comments

Comments
 (0)