Skip to content

Commit c21beb0

Browse files
author
Matej Cotman
authored
Merge pull request #21 from eficode/feat/robotframework-4-support/pr
Support for robotframework 4.x
2 parents 8c3def1 + 8b426ee commit c21beb0

File tree

11 files changed

+814
-399
lines changed

11 files changed

+814
-399
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
python: [python38, python39]
21-
rfVersion: [3.1.2, 3.2, 3.2.1, 3.2.2]
21+
rfVersion: ['3.1.2', '3.2', '3.2.1', '3.2.2', '4.0', '4.0.1', '4.0.2', '4.0.3', '4.1']
2222
runs-on: windows-latest
2323
name: Windows (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
2424
defaults:
@@ -62,7 +62,7 @@ jobs:
6262
fail-fast: false
6363
matrix:
6464
python: [python38, python39]
65-
rfVersion: [3.1.2, 3.2, 3.2.1, 3.2.2]
65+
rfVersion: ['3.1.2', '3.2', '3.2.1', '3.2.2', '4.0', '4.0.1', '4.0.2', '4.0.3', '4.1']
6666
runs-on: ubuntu-latest
6767
name: Linux (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
6868
steps:
@@ -80,7 +80,7 @@ jobs:
8080
fail-fast: false
8181
matrix:
8282
python: [python38, python39]
83-
rfVersion: [3.1.2, 3.2, 3.2.1, 3.2.2]
83+
rfVersion: ['3.1.2', '3.2', '3.2.1', '3.2.2', '4.0', '4.0.1', '4.0.2', '4.0.3', '4.1']
8484
runs-on: macos-latest
8585
name: MacOS (${{ matrix.python }}, robotframework-${{ matrix.rfVersion }})
8686
steps:

src/oxygen/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1+
from .version import VERSION
12
from .base_handler import BaseHandler
23
from .oxygen import listener, OxygenLibrary
3-
from .robot_interface import RobotInterface
4-
from .version import VERSION
54

6-
__all__ = ['BaseHandler', 'listener', 'OxygenLibrary', 'RobotInterface']
5+
__all__ = ['BaseHandler', 'listener', 'OxygenLibrary']
76
__version__ = VERSION
8-
9-
10-

src/oxygen/base_handler.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import re
22

3-
from .robot_interface import RobotInterface
3+
from .robot_interface import (RobotInterface, get_keywords_from,
4+
set_special_keyword)
5+
46

57
class BaseHandler(object):
68
DEFAULT_CLI = {tuple(['resultfile']): {}}
@@ -43,7 +45,9 @@ def check_for_keyword(self, test, data):
4345
4446
test: A Robot test
4547
'''
46-
for curr, keyword in enumerate(test.keywords):
48+
test_keywords = get_keywords_from(test)
49+
50+
for curr, keyword in enumerate(test_keywords):
4751
keyword_name = self._normalize_keyword_name(keyword.name)
4852
if not (keyword_name == self.keyword):
4953
continue
@@ -52,8 +56,8 @@ def check_for_keyword(self, test, data):
5256
# ALL keywords, setup or not, preceding the trigger will be treated
5357
# as setup keywords later. Same goes for keywords succeeding the
5458
# trigger; they will become teardown keywords.
55-
setup_keywords = test.keywords[:curr]
56-
teardown_keywords = test.keywords[(curr+1):]
59+
setup_keywords = test_keywords[:curr]
60+
teardown_keywords = test_keywords[(curr+1):]
5761

5862
self._report_oxygen_run(keyword, setup_keywords, teardown_keywords)
5963

@@ -107,10 +111,10 @@ def _build_results(self, keyword, setup_keyword, teardown_keyword):
107111
self._set_suite_tags(result_suite, *(self._tags + list(test.tags)))
108112

109113
if setup_keyword:
110-
result_suite.keywords.append(setup_keyword)
114+
set_special_keyword(result_suite, 'setup', setup_keyword)
111115

112116
if teardown_keyword:
113-
result_suite.keywords.append(teardown_keyword)
117+
set_special_keyword(result_suite, 'teardown', teardown_keyword)
114118

115119
self._inject_suite_report(test, result_suite)
116120

0 commit comments

Comments
 (0)