Skip to content

Commit

Permalink
Merge pull request #61 from plone/issue-59-connection-refused-reset
Browse files Browse the repository at this point in the history
Fixed test for 'Connection refused' which could be 'Connection reset'.
  • Loading branch information
mauritsvanrees committed Mar 1, 2019
2 parents 4219a3c + 6f92e57 commit 6f54d0e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
1 change: 1 addition & 0 deletions news/59.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed test for 'Connection refused' which could be 'Connection reset'. [maurits]
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
import os.path


version = '7.0.1.dev0'

install_requires = [
Expand Down Expand Up @@ -46,8 +47,8 @@
long_description=(u'\n\n'.join([
open(os.path.join("src", "plone", "testing", "README.rst")).read(),
open("CHANGES.rst").read(),
"Detailed documentation\n" +
"======================",
"Detailed documentation\n"
+ "======================",
open(os.path.join("src", "plone", "testing", "layer.rst")).read(),
open(os.path.join("src", "plone", "testing", "zca.rst")).read(),
open(os.path.join("src", "plone", "testing", "security.rst")).read(),
Expand Down
6 changes: 3 additions & 3 deletions src/plone/testing/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _mergeResourceManagers(self, seqs):

def _resourceResolutionOrder(self, instance):
return self._mergeResourceManagers(
[[instance]] +
list(map(self._resourceResolutionOrder, instance.__bases__)) +
[list(instance.__bases__)]
[[instance]]
+ list(map(self._resourceResolutionOrder, instance.__bases__))
+ [list(instance.__bases__)]
)


Expand Down
15 changes: 11 additions & 4 deletions src/plone/testing/zope.rst
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,14 @@ When the server is torn down, the WSGIServer thread is stopped.::
Tear down plone.testing.zope.Startup in ... seconds.
Tear down plone.testing.zca.LayerCleanup in ... seconds.

>>> conn = urlopen(app_url + '/folder1', timeout=5)
Traceback (most recent call last):
...
URLError: <urlopen error [Errno ...] Connection refused>
We can expect one of these exceptions:
- URLError: <urlopen error [Errno ...] Connection refused>
- error: [Errno 104] Connection reset by peer

>>> try:
... conn = urlopen(app_url + '/folder1', timeout=5)
... except Exception as exc:
... if 'Connection refused' not in str(exc) and 'Connection reset' not in str(exc):
... raise exc
... else:
... print('urlopen should have raised exception')
16 changes: 12 additions & 4 deletions src/plone/testing/zserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -526,10 +526,18 @@ When the server is torn down, the ZServer thread is stopped.::
Tear down plone.testing.zserver.Startup in ... seconds.
Tear down plone.testing.zca.LayerCleanup in ... seconds.

>>> conn = urllib2.urlopen(app_url + '/folder1', timeout=5)
Traceback (most recent call last):
...
URLError: <urlopen error [Errno ...] Connection refused>
We can expect one of these exceptions:
- URLError: <urlopen error [Errno ...] Connection refused>
- error: [Errno 104] Connection reset by peer

>>> try:
... conn = urllib2.urlopen(app_url + '/folder1', timeout=5)
... except Exception as exc:
... if 'Connection refused' not in str(exc) and 'Connection reset' not in str(exc):
... raise exc
... else:
... print('urllib2.urlopen should have raised exception')


FTP server
~~~~~~~~~~
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ deps =
flake8-debugger
flake8-deprecated
flake8-print
flake8-pytest
flake8-todo
# flake8-pytest
# flake8-todo
flake8-isort
mccabe
# Potential flake8 plugins that should be used: # TBD
Expand All @@ -81,7 +81,7 @@ deps =
commands =
mkdir -p {toxinidir}/_build/reports/flake8
- flake8 --format=html --htmldir={toxinidir}/_build/reports/flake8 --doctests src setup.py
flake8 --doctests src tests setup.py
flake8 --doctests --ignore=W503 src tests setup.py
isort --check-only --recursive {toxinidir}/src

whitelist_externals =
Expand Down

1 comment on commit 6f54d0e

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mauritsvanrees Jenkins CI reporting about code analysis
See the full report here: https://jenkins.plone.org/job/package-plone.testing/151/violations

src/plone/testing/layer.py:127:13: W503 line break before binary operator
src/plone/testing/layer.py:128:13: W503 line break before binary operator

Follow these instructions to reproduce it locally.

Please sign in to comment.