List of steps to reproduce (step by step, including full links if applicable):
Some server response is not supported by http.HTTPStatus
https://docs.python.org/3.11/library/http.html?highlight=http#http.HTTPStatus
What happens?:
A status code 522 happened which is unofficial cloudflare Code:
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#Cloudflare
00
======================================================================
6701
ERROR: test_wikifur (tests.site_detect_tests.StandardVersionSiteTestCase)
6702
Test detection of MediaWiki sites for en.wikifur.com.
6703
----------------------------------------------------------------------
6704
Traceback (most recent call last):
6705
File "C:\projects\pywikibot-g4xqx\tests\site_detect_tests.py", line 85, in test_wikifur
6706
self.assertSite('https://en.wikifur.com/wiki/$1')
6707
File "C:\projects\pywikibot-g4xqx\tests\site_detect_tests.py", line 36, in assertSite
6708
self.assertIsInstance(MWSite(url), MWSite)
6709
File "C:\projects\pywikibot-g4xqx\pywikibot\site_detect.py", line 45, in __init__
6710
check_response(r)
6711
File "C:\projects\pywikibot-g4xqx\pywikibot\site_detect.py", line 281, in check_response
6712
raise ServerError(HTTPStatus(response.status_code).phrase)
6713
File "c:\python38\lib\enum.py", line 339, in __call__
6714
return cls.__new__(cls, value)
6715
File "c:\python38\lib\enum.py", line 663, in __new__
6716
raise ve_exc
6717
ValueError: 522 is not a valid HTTPStatus
6718
6719
----------------------------------------------------------------------
6720
Ran 1814 tests in 1210.883s
6721
6722
FAILED (errors=1, skipped=82, expected failures=11)https://ci.appveyor.com/project/Ladsgroup/pywikibot-g4xqx/builds/41126786/job/mc9h7f05w7tff0l9#L6700
What should have happened instead?:
Either add a HTTPStatus subclass to pywikibot.comms.http or create a generic ServerError exception in that case instead of raising the ValueError.