Skip to content

Commit b0f5a4f

Browse files
authored
Merge pull request #210 from reportportal/develop
Release
2 parents 7092aab + ec37ce6 commit b0f5a4f

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Fixed
5+
- Client crash in case of Client ID saving error, by @HardNorth
6+
7+
## [5.3.1]
48
### Added
59
- `MAX_LOG_BATCH_SIZE` constant into `log_manager` module, by @HardNorth
610
### Fixed

reportportal_client/services/client_id.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import configparser
1717
import io
18+
import logging
1819
import os
1920
from uuid import uuid4
2021

@@ -24,6 +25,10 @@
2425
RP_PROPERTIES_FILE_PATH
2526

2627

28+
logger = logging.getLogger(__name__)
29+
logger.addHandler(logging.NullHandler())
30+
31+
2732
class __NoSectionConfigParser(configparser.ConfigParser):
2833
DEFAULT_SECTION = 'DEFAULT'
2934

@@ -77,5 +82,9 @@ def get_client_id():
7782
client_id = _read_client_id()
7883
if not client_id:
7984
client_id = str(uuid4())
80-
_store_client_id(client_id)
85+
try:
86+
_store_client_id(client_id)
87+
except (PermissionError, IOError) as error:
88+
logger.exception('[%s] Unknown exception has occurred. '
89+
'Skipping client ID saving.', error)
8190
return client_id

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from setuptools import setup, find_packages
66

7-
__version__ = '5.3.1'
7+
__version__ = '5.3.2'
88

99
TYPE_STUBS = ['*.pyi']
1010

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def get_call(*args, **kwargs):
123123

124124
@mock.patch('reportportal_client.client.getenv')
125125
@mock.patch('reportportal_client.client.send_event')
126-
def test_skip_analytics(send_event, getenv):
126+
def test_skip_statistics(send_event, getenv):
127127
getenv.return_value = '1'
128128
client = RPClient('http://endpoint', 'project', 'token')
129129
client.session = mock.Mock()
@@ -133,7 +133,7 @@ def test_skip_analytics(send_event, getenv):
133133

134134
@mock.patch('reportportal_client.client.getenv')
135135
@mock.patch('reportportal_client.client.send_event')
136-
def test_analytics(send_event, getenv):
136+
def test_statistics(send_event, getenv):
137137
getenv.return_value = ''
138138
client = RPClient('http://endpoint', 'project', 'token')
139139
client.session = mock.Mock()

0 commit comments

Comments
 (0)