jenkins-bot has submitted this change and it was merged.

Change subject: [FIX] tests: Check site's path availability
......................................................................


[FIX] tests: Check site's path availability

The tests do a simple hostname check before doing a test, but when the hostname
itself is not available but the wiki path it would skip the tests. This is also
using the HEAD method to just check the theoretical availability.

Change-Id: Iee082c12744b1da420903f30177324305f5f65b8
---
M tests/aspects.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/aspects.py b/tests/aspects.py
index 720a1d3..7897601 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -492,13 +492,13 @@
                 if '://' not in hostname:
                     hostname = 'http://' + hostname
                 r = http.fetch(uri=hostname,
+                               method='HEAD',
                                default_error_handling=False)
                 if r.exception:
                     e = r.exception
                 else:
                     if r.status not in [200, 301, 302, 303, 307, 308]:
                         raise ServerError('HTTP status: %d' % r.status)
-                    r.content  # default decode may raise exception
             except Exception as e2:
                 pywikibot.error('%s: accessing %s caused exception:'
                                 % (cls.__name__, hostname))
@@ -888,7 +888,7 @@
                                     interface=interface)
             if 'hostname' not in data and 'site' in data:
                 try:
-                    data['hostname'] = data['site'].hostname()
+                    data['hostname'] = 
data['site'].base_url(data['site'].path())
                 except KeyError:
                     # The family has defined this as obsolete
                     # without a mapping to a hostname.

-- 
To view, visit https://gerrit.wikimedia.org/r/234810
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iee082c12744b1da420903f30177324305f5f65b8
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>
Gerrit-Reviewer: John Vandenberg <jay...@gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to