Skip to content

Commit 211e5cd

Browse files
committed
Annotate plugin with name & version attributes
1 parent 8ef2e04 commit 211e5cd

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

setup.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
#!/usr/bin/env python
22
# coding: utf-8
33
# pylint: disable=missing-docstring
4+
import os
45
from setuptools import setup
56

67

8+
def get_version():
9+
version_py_path = os.path.join('zealand', 'version.py')
10+
with open(version_py_path, encoding="utf-8") as version_file:
11+
version = version_file.read()
12+
return version.replace(
13+
' ', ''
14+
).replace('__version__=', '').strip().strip("'").strip('"')
15+
16+
717
with open("README.rst", encoding="utf-8") as readme:
818
LONG_DESCRIPTION = readme.read()
919

@@ -13,7 +23,7 @@
1323

1424

1525
setup(name='kiwitcms-robotframework-plugin',
16-
version='11.0',
26+
version=get_version(),
1727
packages=['zealand'],
1828
description='robotframework integration with kiwi TCMS',
1929
long_description=LONG_DESCRIPTION,

zealand/listener.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
from robot.libraries.BuiltIn import BuiltIn
55
from tcms_api.plugin_helpers import Backend
66

7+
from .version import __version__
8+
79

810
class RFBackend(Backend):
911
"""
1012
Kiwi TCMS plugin backend which has richer integration with
1113
Robot Framework internals than standard backend!
1214
"""
15+
name = "kiwitcms-robotframework-plugin"
16+
version = __version__
1317
built_in = BuiltIn()
1418
cwd = os.getcwd() + os.sep
1519

@@ -122,8 +126,7 @@ def rf_test_case_get_or_create(self, attrs):
122126
attrs['longname'])
123127

124128
if created:
125-
notes = attrs['suite']['doc'] or \
126-
'Created by kiwitcms-robotframework-plugin'
129+
notes = attrs['suite']['doc'] or self.created_by_text
127130

128131
self.rpc.TestCase.update(
129132
test_case['id'],
@@ -202,8 +205,7 @@ def end_test(self, name, attrs): # pylint: disable=unused-argument
202205
test_case_id = test_case['id']
203206

204207
self.backend.add_test_case_to_plan(test_case_id, self.backend.plan_id)
205-
comment = attrs['message'] or \
206-
'Result recorded via kiwitcms-robotframework-plugin'
208+
comment = attrs['message'] or self.backend.created_by_text
207209
status_id = self.backend.get_status_id(attrs['status'])
208210

209211
for execution in self.backend.add_test_case_to_run(

zealand/version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '11.0'

0 commit comments

Comments
 (0)