Xqt created this task.
Xqt added a project: Pywikibot-tests.
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper.
Restricted Application added a project: Pywikibot.
TASK DESCRIPTION
==================================== ERRORS
====================================
_____________ ERROR at setup of HttpServerProblemTestCase.test_502
_____________
cls = <class 'tests.tests_tests.HttpServerProblemTestCase'>
@classmethod
def setUpClass(cls):
"""
Set up the test class.
Prevent tests running if the host is down.
"""
super().setUpClass()
if not hasattr(cls, 'sites'):
return
if issubclass(cls, HttpbinTestCase):
# If test uses httpbin, then check is pytest test runner is used
# and pytest_httpbin module is installed.
httpbin_used = hasattr(sys,
'_test_runner_pytest') and pytest_httpbin
else:
httpbin_used = False
# If pytest_httpbin will be used during tests, then remove
httpbin.org
# from sites.
if httpbin_used:
cls.sites = {k: v for k, v in cls.sites.items()
if 'httpbin.org' not in v['hostname']}
for key, data in cls.sites.items():
if 'hostname' not in data:
raise Exception('{}: hostname not defined for {}'
.format(cls.__name__, key))
hostname = data['hostname']
if hostname in cls._checked_hostnames:
if isinstance(cls._checked_hostnames[hostname], Exception):
raise unittest.SkipTest(
'{}: hostname {} failed (cached): {}'
.format(cls.__name__, hostname,
cls._checked_hostnames[hostname]))
elif cls._checked_hostnames[hostname] is False:
raise unittest.SkipTest('{}: hostname {} failed
(cached)'
.format(cls.__name__, hostname))
else:
continue
e = None
try:
if '://' not in hostname:
hostname = 'http://' + hostname
r = http.fetch(hostname,
method='HEAD',
default_error_handling=False)
if r.status_code not in {200, 301, 302, 303, 307, 308}:
raise ServerError('HTTP status:
{}'.format(r.status_code))
except Exception as e:
pywikibot.error('{}: accessing {} caused exception:'
.format(cls.__name__, hostname))
pywikibot.exception(e, tb=True)
> if e:
E UnboundLocalError: local variable 'e' referenced before
assignment
tests/aspects.py:467: UnboundLocalError
------------------------------ Captured log setup
------------------------------
ERROR pywiki:logging.py:101 HttpServerProblemTestCase: accessing
http://httpbin.org/status/502 caused exception:
ERROR pywiki:logging.py:101 HTTP status: 502
Traceback (most recent call last):
File "/home/travis/build/wikimedia/pywikibot/tests/aspects.py", line 461,
in setUpClass
raise ServerError('HTTP status: {}'.format(r.status_code))
pywikibot.exceptions.ServerError: HTTP status: 50
TASK DETAIL
https://phabricator.wikimedia.org/T272153
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Xqt
Cc: Aklapper, pywikibot-bugs-list, Xqt, JohnsonLee01, SHEKH, Dijkstra, Khutuck,
Zkhalido, Viztor, Wenyi, Tbscho, MayS, Mdupont, JJMC89, Dvorapa, Altostratus,
Avicennasis, mys_721tx, jayvdb, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs