jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/475597 )
Change subject: proofreadpage.py: test connection with wmflabs ......................................................................
proofreadpage.py: test connection with wmflabs
Add test to check connectivity with wmflabs servers. This is useful to check if tests fail due to problems with such requests.
Change-Id: I9dff9289740d966158a8f0205b8ba54adbb9f4ed --- M tests/proofreadpage_tests.py 1 file changed, 11 insertions(+), 0 deletions(-)
Approvals: Mpaa: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py index cd77337..74474b3 100644 --- a/tests/proofreadpage_tests.py +++ b/tests/proofreadpage_tests.py @@ -11,6 +11,7 @@
import pywikibot
+from pywikibot.comms import http from pywikibot.data import api from pywikibot.proofreadpage import IndexPage, ProofreadPage
@@ -362,6 +363,16 @@ self.assertEqual(error, ref_error) self.assertEqual(text, ref_text)
+ def test_do_ocr_phetools_raw_request(self): + """Test page._do_ocr connection with wmflabs.""" + uri = ('https://tools.wmflabs.org/phetools/ocr.php?cmd=ocr' + '&url=https://upload.wikimedia.org/wikipedia/commons/' + 'thumb/a/ac/Popular_Science_Monthly_Volume_1.djvu/' + 'page10-1024px-Popular_Science_Monthly_Volume_1.djvu.jpg' + '&lang=en&user=None') + response = http.fetch(uri) + self.assertEqual(response.status, 200) + def test_do_ocr_phetools(self): """Test page._do_ocr(ocr_tool='phetools').""" error, text = self.page._do_ocr(ocr_tool='phetools')
pywikibot-commits@lists.wikimedia.org