Skip to content

Commit 848800d

Browse files
authored
Merge branch 'master' into batch_size
2 parents f164f86 + 4cd2349 commit 848800d

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ python:
55
- "3.4"
66
- "3.5"
77
- "3.6"
8+
install:
9+
- pip install pep8
10+
before_script:
11+
pep8 .
812
script:
913
- python setup.py -q install

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
Library used only for implementors of custom listeners for ReportPortal
77

88

9-
## Allready implemented listeners:
9+
## Already implemented listeners:
1010

11-
- [Robot Framework](https://github.com/reportportal/agent-Python-RobotFramework)
1211
- [PyTest Framework](https://github.com/reportportal/agent-python-pytest)
12+
- [Robot Framework](https://github.com/reportportal/agent-Python-RobotFramework)
1313

1414

1515
## Installation
@@ -57,9 +57,9 @@ def my_error_handler(exc_info):
5757
This callback function will be called by async service client when error occurs.
5858
Return True if error is not critical and you want to continue work.
5959
:param exc_info: result of sys.exc_info() -> (type, value, traceback)
60-
:return:
60+
:return:
6161
"""
62-
print("Error occured: {}".format(exc_info[1]))
62+
print("Error occurred: {}".format(exc_info[1]))
6363
traceback.print_exception(*exc_info)
6464

6565

@@ -76,7 +76,7 @@ test = service.start_test_item(name="Test Case",
7676
description="First Test Case",
7777
tags=["Image", "Smoke"],
7878
start_time=timestamp(),
79-
item_type="TEST")
79+
item_type="STEP")
8080

8181
# Create text log message with INFO level.
8282
service.log(time=timestamp(),
@@ -89,7 +89,7 @@ service.log(time=timestamp(),
8989
level="WARN",
9090
attachment={
9191
"name": "free_memory.txt",
92-
"data": subprocess.check_output("ps".split()),
92+
"data": subprocess.check_output("free -h".split()),
9393
"mime": "text/plain"
9494
})
9595

@@ -117,7 +117,7 @@ service.finish_test_item(end_time=timestamp(), status="PASSED")
117117
service.finish_launch(end_time=timestamp())
118118

119119
# Due to async nature of the service we need to call terminate() method which
120-
# ensures all pending requests to server are proccessed.
120+
# ensures all pending requests to server are processed.
121121
# Failure to call terminate() may result in lost data.
122122
service.terminate()
123123
```

reportportal_client/service_async.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,23 +97,23 @@ def stop(self, nowait=False):
9797
This asks the thread to terminate, and then waits for it to do so.
9898
Note that if you don't call this before your application exits, there
9999
may be some records still left on the queue, which won't be processed.
100-
If nowait is False then thread will handle remaining items in queue and
100+
If nowait is False then thread will handle remaining items in queue and
101101
stop.
102-
If nowait is True then thread will be stopped even if the queue still
102+
If nowait is True then thread will be stopped even if the queue still
103103
contains items.
104104
"""
105105
self._stop.set()
106106
if nowait:
107107
self._stop_nowait.set()
108108
self.queue.put_nowait(self._sentinel_item)
109-
if (self._thread.isAlive()
110-
and self._thread is not threading.currentThread()):
109+
if (self._thread.isAlive() and
110+
self._thread is not threading.currentThread()):
111111
self._thread.join()
112112
self._thread = None
113113

114114

115115
class ReportPortalServiceAsync(object):
116-
"""Wrapper around service class to transparently provide async operations
116+
"""Wrapper around service class to transparently provide async operations
117117
to agents."""
118118

119119
def __init__(self, endpoint, project, token, api_base="api/v1",
@@ -125,13 +125,14 @@ def __init__(self, endpoint, project, token, api_base="api/v1",
125125
project: project name to use for launch names.
126126
token: authorization token.
127127
api_base: defaults to api/v1, can be changed to other version.
128-
error_handler: function to be called to handle errors occured during
129-
items processing (in thread)
128+
error_handler: function to be called to handle errors occurred
129+
during items processing (in thread)
130130
"""
131131
super(ReportPortalServiceAsync, self).__init__()
132132
self.error_handler = error_handler
133133
self.log_batch_size = log_batch_size
134-
self.rp_client = ReportPortalService(endpoint, project, token, api_base)
134+
self.rp_client = ReportPortalService(
135+
endpoint, project, token, api_base)
135136
self.log_batch = []
136137
self.supported_methods = ["start_launch", "finish_launch",
137138
"start_test_item", "finish_test_item", "log"]
@@ -156,7 +157,7 @@ def terminate(self, nowait=False):
156157
try:
157158
if not nowait:
158159
self._post_log_batch()
159-
except Exception as err:
160+
except Exception:
160161
if self.error_handler:
161162
self.error_handler(sys.exc_info())
162163
else:
@@ -200,7 +201,7 @@ def process_item(self, item):
200201
else:
201202
self._post_log_batch()
202203
getattr(self.rp_client, method)(**kwargs)
203-
except Exception as err:
204+
except Exception:
204205
if self.error_handler:
205206
if not self.error_handler(sys.exc_info()):
206207
self.terminate(nowait=True)

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
version='2.6.0',
77
description='Python client for Report Portal',
88
author='Artsiom Tkachou',
9-
author_email='artsiom_tkachou@epam.com',
9+
author_email='SupportEPMC-TSTReportPortal@epam.com',
1010
url='https://github.com/reportportal/client-Python',
1111
download_url='https://github.com/reportportal/client-Python/tarball/2.6.0',
12+
license='GNU General Public License v3',
1213
keywords=['testing', 'reporting', 'reportportal'],
1314
classifiers=[],
14-
install_requires=["requests>=2.4.2"],
15+
install_requires=['requests>=2.4.2'],
1516
)

0 commit comments

Comments
 (0)