skip tests on read timeouts; print list of skipped tests

This commit is contained in:
Mike Fährmann
2019-06-01 17:15:32 +02:00
parent 1c36e65e9b
commit 6a34f4b0c1
2 changed files with 18 additions and 3 deletions

View File

@@ -46,8 +46,8 @@ class PahealTagExtractor(PahealExtractor):
pattern = (r"(?:https?://)?(?:rule34|rule63|cosplay)\.paheal\.net" pattern = (r"(?:https?://)?(?:rule34|rule63|cosplay)\.paheal\.net"
r"/post/list/([^/?&#]+)") r"/post/list/([^/?&#]+)")
test = ("https://rule34.paheal.net/post/list/k-on/1", { test = ("https://rule34.paheal.net/post/list/k-on/1", {
"url": "0f5a777cea524635760de32dd85a3de5ac5f3f43", "url": "69351072a4d4aba9fc76c6f5defd7b0800550a12",
"keyword": "4cb563a2bdcb443e1087aa11eb0f7add03aa8bd2", "keyword": "327b8216cdd0347562ca502c6301928129e4e0d0",
}) })
per_page = 70 per_page = 70

View File

@@ -26,6 +26,7 @@ TRAVIS_SKIP = {
# temporary issues, etc. # temporary issues, etc.
BROKEN = { BROKEN = {
"fallenangels",
"mangapark", "mangapark",
"simplyhentai", "simplyhentai",
} }
@@ -39,6 +40,17 @@ class TestExtractorResults(unittest.TestCase):
def tearDown(self): def tearDown(self):
config.clear() config.clear()
@classmethod
def setUpClass(cls):
cls._skipped = []
@classmethod
def tearDownClass(cls):
if cls._skipped:
print("\n\nSkipped tests:")
for url, exc in cls._skipped:
print('- {} ("{}")'.format(url, exc))
def _run_test(self, extr, url, result): def _run_test(self, extr, url, result):
if result: if result:
if "options" in result: if "options" in result:
@@ -65,7 +77,10 @@ class TestExtractorResults(unittest.TestCase):
except exception.StopExtraction: except exception.StopExtraction:
pass pass
except exception.HttpError as exc: except exception.HttpError as exc:
if re.match(r"5\d\d: ", str(exc)): exc = str(exc)
if re.match(r"5\d\d: ", exc) or \
re.search(r"\bRead timed out\b", exc):
self._skipped.append((url, exc))
self.skipTest(exc) self.skipTest(exc)
raise raise