Skip to content

Commit e2bfcf5

Browse files
Merge pull request #2913 from HelioGuilherme66/develop
Fix full path keywords (#158)
2 parents 2814a28 + 3b69b3c commit e2bfcf5

File tree

16 files changed

+177
-78
lines changed

16 files changed

+177
-78
lines changed

CHANGELOG.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ All notable changes to this project will be documented in this file.
66
The format is based on http://keepachangelog.com/en/1.0.0/[Keep a Changelog]
77
and this project adheres to http://semver.org/spec/v2.0.0.html[Semantic Versioning].
88

9-
// == https://github.com/robotframework/RIDE[Unreleased]
9+
== https://github.com/robotframework/RIDE[Unreleased]
10+
11+
== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.1.rst[2.1.1] - 2024-11-14
12+
13+
=== Fixed
14+
15+
- Fixed no recognition of keywords with embedded arguments and full name. Issue #1106 from 12 Sep 2012.
1016

1117
== https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride-2.1.1.rst[2.1.1] - 2024-11-14
1218

README.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ See the https://github.com/robotframework/RIDE/blob/master/doc/releasenotes/ride
3131
**Version https://github.com/robotframework/RIDE/tree/release/1.7.4.2[1.7.4.2] was the last release supporting Python 2.7**
3232

3333

34-
**The current development version is based on 2.1, supports Python from 3.8 up to 3.13 (5th November 2024).**
34+
**The current development version is based on 2.1,1, supports Python from 3.8 up to 3.13 (20th November 2024).**
3535

3636
Currently, the unit tests are tested on Python 3.10, 3.11 and 3.13 (but 3.12 is the recommended version).
3737
Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work with 4.0.7 and 4.1.1 versions.
@@ -40,7 +40,7 @@ Likewise, the current version of wxPython, is 4.2.2, but RIDE is known to work w
4040

4141
`pip install -U robotframework-ride`
4242

43-
(3.8 <= python <= 3.13) Install current development version (**2.1.1**) with:
43+
(3.8 <= python <= 3.13) Install current development version (**2.2dev1**) with:
4444

4545
`pip install -U https://github.com/robotframework/RIDE/archive/develop.zip`
4646

src/robotide/application/CHANGELOG.html

Lines changed: 50 additions & 48 deletions
Large diffs are not rendered by default.

src/robotide/application/releasenotes.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,7 @@ def set_content(self, html_win, content):
169169
</ul>
170170
<p><strong>New Features and Fixes Highlights</strong></p>
171171
<ul class="simple">
172-
<li>Fixed broken go to definition after editing content in resource files.</li>
173-
<li>Fixed long arguments in fixtures appearing splitted in Grid Editor. Still, arguments info will not be correct at
174-
calling step.</li>
175-
<li>Fixed double action on Linux when pressing the DEL key</li>
172+
<li>Fixed no recognition of keywords with embedded arguments and full name. Issue #1106 from 12 Sep 2012.</li>
176173
</ul>
177174
<!-- <p>We hope to implement or complete features and make fixes on next major version 2.1 (in mid Autumm of 2024).</p>
178175
-->
@@ -227,7 +224,7 @@ def set_content(self, html_win, content):
227224
<pre class="literal-block">python -m robotide.postinstall -install</pre>
228225
<p>or</p>
229226
<pre class="literal-block">ride_postinstall.py -install</pre>
230-
<p>RIDE {VERSION} was released on 14/November/2024.</p>
227+
<p>RIDE {VERSION} was released on 20/November/2024.</p>
231228
<!-- <br/>
232229
<h3>May The Fourth Be With You!</h3>
233230
<h3>Celebrate the bank holiday, 10th June, Day of Portugal, Portuguese Communities and Camões!!</h3>

src/robotide/controller/filecontrollers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ def metadata(self):
265265

266266
def is_user_keyword(self, datafile, value):
267267
_ = datafile
268+
# print(f"DEBUG: filecontrollers.py _DataController is_user_keyword datafile={datafile} "
269+
# f" value={value}")
268270
return WithNamespace.is_user_keyword(self, self.datafile, value)
269271

270272
def is_library_keyword(self, datafile, value):

src/robotide/namespace/embeddedargs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ class EmbeddedArgsHandler(object):
2020

2121
def __init__(self, keyword):
2222
if keyword.arguments:
23-
raise TypeError('Cannot have normal arguments')
24-
self.name_regexp, self.embedded_args = \
25-
EmbeddedArgumentParser().parse(keyword.name)
23+
# raise TypeError('Cannot have normal arguments')
24+
print('DEBUG: Found normal arguments in embedded arguments keyword.')
25+
# print(f'DEBUG: embeddedargs.py EmbeddedArgsHandler keyword={keyword.name} longname={keyword.longname}')
26+
self.name_regexp, self.embedded_args = EmbeddedArgumentParser().parse(keyword.name)
27+
if hasattr(keyword, 'longname'):
28+
self.longname_regexp, _ = EmbeddedArgumentParser().parse(keyword.longname)
2629
if not self.embedded_args:
2730
raise TypeError('Must have embedded arguments')

src/robotide/namespace/namespace.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ def new_resource(self, path, directory=''):
203203

204204
def find_user_keyword(self, datafile, kw_name):
205205
kw = self.find_keyword(datafile, kw_name)
206+
# print(f"DEBUG: namespace.py Namespace find_user_keyword datafile={datafile} "
207+
# f" kw_name={kw_name} keyword={kw}")
206208
return kw if isinstance(kw, UserKeywordInfo) else None
207209

208210
def is_user_keyword(self, datafile, kw_name):
@@ -633,18 +635,28 @@ def _add_embedded(self, kw):
633635
try:
634636
handler = EmbeddedArgsHandler(kw)
635637
self.embedded_keywords[handler.name_regexp] = kw
638+
if hasattr(handler, 'longname_regexp'):
639+
self.embedded_keywords[handler.longname_regexp] = kw
640+
# print(f"DEBUG: namespace.py _add_embedded add kw={kw.name} longname={kw.longname}\n"
641+
# f"handler.name_regexp={handler.name_regexp}")
636642
except TypeError:
637643
pass
638644

639645
def get(self, kw_name):
640646
if kw_name in self.keywords:
641647
return self.keywords[kw_name]
648+
# print(f"DEBUG: namespace.py _Keywords get keywords {self.keywords}")
642649
bdd_name = self._get_bdd_name(kw_name)
643650
if bdd_name and bdd_name in self.keywords:
644651
return self.keywords[bdd_name]
652+
# print(f"DEBUG: namespace.py _Keywords get embedded kws {self.embedded_keywords}"
653+
# f"\nseaching keyword={kw_name}")
645654
for regexp in self.embedded_keywords:
646-
if regexp.match(kw_name) or (bdd_name and regexp.match(bdd_name)):
647-
return self.embedded_keywords[regexp]
655+
try:
656+
if regexp.match(kw_name) or (bdd_name and regexp.match(bdd_name)):
657+
return self.embedded_keywords[regexp]
658+
except AttributeError:
659+
pass
648660
return None
649661

650662
def _get_bdd_name(self, kw_name):

src/robotide/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Automatically generated by `tasks.py`.
1717

18-
VERSION = 'v2.1.1'
18+
VERSION = 'v2.2dev1'

utest/application/test_updatenotifier.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
import pytest
16+
import sys
1517
import typing
1618
import unittest
1719
import time
1820
import urllib
1921

2022
from robotide.application.updatenotifier import UpdateNotifierController, UpdateDialog
2123

24+
IS_WINDOWS = sys.platform=='win32'
25+
2226
CHECKFORUPDATES = 'check for updates'
2327
LASTUPDATECHECK = 'last update check'
2428

@@ -222,6 +226,7 @@ def test_no_update_found_dev(self):
222226
self.assertGreater(settings[LASTUPDATECHECK], time.time() - 1)
223227
self.assertFalse(self._callback_called)
224228

229+
@pytest.mark.skipif(IS_WINDOWS, reason='Causes: Windows fatal exception: access violation')
225230
def test_no_update_found_dev_notify(self):
226231
settings = self.internal_settings()
227232
ctrl = self._update_notifier_controller(settings, self.notebook, '0.55', '0.55')
@@ -287,6 +292,7 @@ def test_server_returns_older_version(self):
287292
self.assertTrue(settings[CHECKFORUPDATES])
288293
self.assertFalse(self._callback_called)
289294

295+
@pytest.mark.skipif(IS_WINDOWS, reason='Causes: Windows fatal exception: access violation')
290296
def test_forced_check_released(self):
291297
settings = self.internal_settings()
292298
ctrl = self._update_notifier_controller(settings, self.notebook, '0.43.0', '0.43.1')
@@ -295,6 +301,7 @@ def test_forced_check_released(self):
295301
self.assertTrue(settings[CHECKFORUPDATES])
296302
self.assertTrue(self._callback_called)
297303

304+
@pytest.mark.skipif(IS_WINDOWS, reason='Causes: Windows fatal exception: access violation')
298305
def test_forced_check_development(self):
299306
settings = self.internal_settings()
300307
ctrl = self._update_notifier_controller(settings, self.notebook, '0.44dev12', '0.44.dev14')
@@ -303,6 +310,7 @@ def test_forced_check_development(self):
303310
self.assertTrue(settings[CHECKFORUPDATES])
304311
self.assertTrue(self._callback_called)
305312

313+
@pytest.mark.skipif(IS_WINDOWS, reason='Causes: Windows fatal exception: access violation')
306314
def test_forced_check_development_ok(self):
307315
settings = self.internal_settings()
308316
ctrl = self._update_notifier_controller(settings, self.notebook, '0.44dev12', '0.44.dev12')
@@ -311,6 +319,7 @@ def test_forced_check_development_ok(self):
311319
self.assertTrue(settings[CHECKFORUPDATES])
312320
self.assertFalse(self._callback_called)
313321

322+
@pytest.mark.skipif(IS_WINDOWS, reason='Causes: Windows fatal exception: access violation')
314323
def test_normal_update_dialog(self):
315324
""" This is not actually doing a test """
316325
settings = self.internal_settings()

utest/controller/test_cellinfo.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,5 +415,57 @@ def _verify_cell_info(self, row, col, contenttype, celltype, macro=None):
415415
assert cell_info.content_type == contenttype
416416

417417

418+
419+
class TestEmbeddedCellInfo(unittest.TestCase):
420+
421+
@classmethod
422+
def setUpClass(cls):
423+
cls.project_ctrl = datafilereader.construct_project(datafilereader.EMBEDDED_PROJECT)
424+
# print(f"DEBUG: TestEmbeddedCellInfo setUpClass project_ctrl: {cls.project_ctrl.display_name}"
425+
# f" {cls.project_ctrl.datafiles}")
426+
cls.testsuite = cls.project_ctrl.datafiles[0]
427+
cls.test1 = cls.testsuite.tests[0]
428+
cls.test2 = cls.testsuite.tests[1]
429+
430+
@classmethod
431+
def tearDownClass(cls):
432+
cls.project_ctrl.close()
433+
434+
def test_var_and_kw(self):
435+
# print("DEBUG: test_var_and_kw:")
436+
# for s in self.test1.steps:
437+
# print(f"{s.as_list()}")
438+
self._verify_cell_info(0, 0, ContentType.LIBRARY_KEYWORD, CellType.KEYWORD, self.test1)
439+
self._verify_cell_info(0, 1, ContentType.UNKNOWN_VARIABLE, CellType.OPTIONAL, self.test1)
440+
self._verify_cell_info(0, 2, ContentType.STRING, CellType.OPTIONAL, self.test1)
441+
self._verify_cell_info(1, 0, ContentType.USER_KEYWORD, CellType.KEYWORD, self.test1)
442+
self._verify_cell_info(2, 0, ContentType.USER_KEYWORD, CellType.KEYWORD, self.test1)
443+
# This was at TearDown
444+
self.test1.execute(delete_rows([i for i in range(len(self.test1.steps))]))
445+
446+
def test_var_and_kw_prefix_resource(self):
447+
# print("DEBUG: test_var_and_kw:")
448+
# for s in self.test2.steps:
449+
# print(f"{s.as_list()}")
450+
self._verify_cell_info(0, 0, ContentType.LIBRARY_KEYWORD, CellType.KEYWORD, self.test2)
451+
self._verify_cell_info(0, 1, ContentType.UNKNOWN_VARIABLE, CellType.OPTIONAL, self.test2)
452+
self._verify_cell_info(0, 2, ContentType.STRING, CellType.OPTIONAL, self.test2)
453+
self._verify_cell_info(1, 0, ContentType.USER_KEYWORD, CellType.KEYWORD, self.test2)
454+
self._verify_cell_info(2, 0, ContentType.LIBRARY_KEYWORD, CellType.KEYWORD, self.test2)
455+
self._verify_cell_info(2, 1, ContentType.UNKNOWN_VARIABLE, CellType.OPTIONAL, self.test2)
456+
self._verify_cell_info(2, 2, ContentType.STRING, CellType.OPTIONAL, self.test2)
457+
self._verify_cell_info(3, 0, ContentType.USER_KEYWORD, CellType.KEYWORD, self.test2)
458+
self._verify_cell_info(3, 1, ContentType.VARIABLE, CellType.MANDATORY, self.test2)
459+
# This was at TearDown
460+
self.test2.execute(delete_rows([i for i in range(len(self.test2.steps))]))
461+
462+
@staticmethod
463+
def _verify_cell_info(row, col, contenttype, celltype, macro=None):
464+
cell_info = macro.get_cell_info(row, col)
465+
# print(f"DEBUG:test_cellinfo type cell_type{cell_info.cell_type} content_type{cell_info.content_type}")
466+
assert cell_info.cell_type == celltype
467+
assert cell_info.content_type == contenttype
468+
469+
418470
if __name__ == "__main__":
419471
unittest.main()

0 commit comments

Comments
 (0)