Skip to content

Commit 13a9317

Browse files
RCB-596: expose set_pool_size; remove pep8 plugin from pytest
1 parent 6a0d471 commit 13a9317

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

pytest.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[pytest]
2-
pep8ignore = E501
32
norecursedirs =
43
.tox
5-
target
4+
target

rosette/api.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,10 @@ def get_user_agent_string(self):
613613
""" Return the User-Agent string """
614614
return self.user_agent_string
615615

616-
def _set_pool_size(self):
616+
def set_pool_size(self, new_pool_size):
617+
self.max_pool_size = new_pool_size
617618
adapter = requests.adapters.HTTPAdapter(
618-
pool_maxsize=self.max_pool_size)
619+
pool_maxsize=new_pool_size)
619620
if 'https:' in self.service_url:
620621
self.session.mount('https://', adapter)
621622
else:
@@ -651,10 +652,8 @@ def _make_request(self, operation, url, data, headers):
651652
rdata = response.content
652653
dict_headers = dict(response.headers)
653654
response_headers = {"responseHeaders": dict_headers}
654-
if 'x-rosetteapi-concurrency' in dict_headers:
655-
if dict_headers['x-rosetteapi-concurrency'] != self.max_pool_size:
656-
self.max_pool_size = dict_headers['x-rosetteapi-concurrency']
657-
self._set_pool_size()
655+
if 'x-rosetteapi-concurrency' in dict_headers and dict_headers['x-rosetteapi-concurrency'] != self.max_pool_size:
656+
self.set_pool_size(dict_headers['x-rosetteapi-concurrency'])
658657

659658
if status == 200:
660659
return rdata, status, response_headers

tests/tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ envlist = py2, py3
44

55
[testenv]
66
commands =
7-
pytest -s --pep8
7+
pytest -s
88
deps =
99
pytest
10-
pytest-pep8
1110
httpretty
1211
epydoc
1312
requests

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ envlist = py2, py3
1010
[testenv]
1111
commands =
1212
{envpython} setup.py install
13-
{envbindir}/py.test --pep8
13+
{envbindir}/py.test
1414
deps =
1515
pytest
1616
pep8
17-
pytest-pep8
1817
httpretty
1918
epydoc
2019
requests

0 commit comments

Comments
 (0)