diff --git a/news/59.bugfix b/news/59.bugfix new file mode 100644 index 0000000..59f688a --- /dev/null +++ b/news/59.bugfix @@ -0,0 +1 @@ +Fixed test for 'Connection refused' which could be 'Connection reset'. [maurits] diff --git a/setup.py b/setup.py index 9fd0f00..cde47b9 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ import os import os.path + version = '7.0.1.dev0' install_requires = [ @@ -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(), diff --git a/src/plone/testing/layer.py b/src/plone/testing/layer.py index a95b8c6..90dc791 100644 --- a/src/plone/testing/layer.py +++ b/src/plone/testing/layer.py @@ -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__)] ) diff --git a/src/plone/testing/zope.rst b/src/plone/testing/zope.rst index 61cdb79..9c351de 100644 --- a/src/plone/testing/zope.rst +++ b/src/plone/testing/zope.rst @@ -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: +We can expect one of these exceptions: +- URLError: +- 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') diff --git a/src/plone/testing/zserver.rst b/src/plone/testing/zserver.rst index df94d1c..d7ec4f4 100644 --- a/src/plone/testing/zserver.rst +++ b/src/plone/testing/zserver.rst @@ -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: +We can expect one of these exceptions: +- URLError: +- 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 ~~~~~~~~~~ diff --git a/tox.ini b/tox.ini index 4cf753d..7447371 100644 --- a/tox.ini +++ b/tox.ini @@ -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 @@ -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 =