[tests] rework filters for extractor tests
CI incompatible tests will now only be skipped if tests are run in a CI environment.
This commit is contained in:
@@ -15,9 +15,10 @@ class PowermangaChapterExtractor(foolslide.FoolslideChapterExtractor):
|
|||||||
"""Extractor for manga-chapters from powermanga.org"""
|
"""Extractor for manga-chapters from powermanga.org"""
|
||||||
category = "powermanga"
|
category = "powermanga"
|
||||||
pattern = foolslide.chapter_pattern(r"read(?:er)?\.powermanga\.org")
|
pattern = foolslide.chapter_pattern(r"read(?:er)?\.powermanga\.org")
|
||||||
test = [("https://read.powermanga.org/read/one_piece/en/0/803/page/1", {
|
test = [(("https://read.powermanga.org"
|
||||||
"url": "e6179c1565068f99180620281f86bdd25be166b4",
|
"/read/one_piece_digital_colour_comics/en/0/75/"), {
|
||||||
"keyword": "224cab1f946d976ddbe4ef88fa1c02303699910b",
|
"url": "854c5817f8f767e1bccd05fa9d58ffb5a4b09384",
|
||||||
|
"keyword": "9bf211d435060d1e38d3d13e4aaaa5a87381bfad",
|
||||||
})]
|
})]
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ class PowermangaMangaExtractor(foolslide.FoolslideMangaExtractor):
|
|||||||
"""Extractor for manga from powermanga.org"""
|
"""Extractor for manga from powermanga.org"""
|
||||||
category = "powermanga"
|
category = "powermanga"
|
||||||
pattern = foolslide.manga_pattern(r"read\.powermanga\.org")
|
pattern = foolslide.manga_pattern(r"read\.powermanga\.org")
|
||||||
test = [("https://read.powermanga.org/series/one_piece/", {
|
test = [(("https://read.powermanga.org"
|
||||||
|
"/series/one_piece_digital_colour_comics/"), {
|
||||||
"count": ">= 1",
|
"count": ">= 1",
|
||||||
"keyword": {
|
"keyword": {
|
||||||
"chapter": int,
|
"chapter": int,
|
||||||
@@ -34,7 +36,7 @@ class PowermangaMangaExtractor(foolslide.FoolslideMangaExtractor):
|
|||||||
"group": "PowerManga",
|
"group": "PowerManga",
|
||||||
"lang": "en",
|
"lang": "en",
|
||||||
"language": "English",
|
"language": "English",
|
||||||
"manga": "One Piece",
|
"manga": "One Piece Digital Colour Comics",
|
||||||
"title": str,
|
"title": str,
|
||||||
"volume": int,
|
"volume": int,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,22 +7,21 @@
|
|||||||
# it under the terms of the GNU General Public License version 2 as
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
# published by the Free Software Foundation.
|
# published by the Free Software Foundation.
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
from gallery_dl import extractor, job, config, exception
|
from gallery_dl import extractor, job, config, exception
|
||||||
|
|
||||||
|
|
||||||
SKIP = {
|
# these don't work on travis-ci
|
||||||
# don't work on travis-ci
|
TRAVIS_SKIP = {
|
||||||
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie",
|
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie",
|
||||||
"archivedmoe", "archiveofsins", "thebarchive",
|
"archivedmoe", "archiveofsins", "thebarchive",
|
||||||
|
}
|
||||||
|
|
||||||
# temporary issues
|
# temporary issues, etc.
|
||||||
"imgcandy",
|
BROKEN = {
|
||||||
"imgchili",
|
"puremashiro", # online reader down
|
||||||
"imgtrex",
|
|
||||||
"powermanga",
|
|
||||||
"puremashiro",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -134,20 +133,30 @@ def generate_tests():
|
|||||||
# enable selective testing for direct calls
|
# enable selective testing for direct calls
|
||||||
if __name__ == '__main__' and len(sys.argv) > 1:
|
if __name__ == '__main__' and len(sys.argv) > 1:
|
||||||
if sys.argv[1].lower() == "all":
|
if sys.argv[1].lower() == "all":
|
||||||
extractors = extractor.extractors()
|
fltr = lambda c, bc: True # noqa: E731
|
||||||
|
elif sys.argv[1].lower() == "broken":
|
||||||
|
fltr = lambda c, bc: c in BROKEN # noqa: E731
|
||||||
else:
|
else:
|
||||||
extractors = [
|
argv = sys.argv[1:]
|
||||||
extr for extr in extractor.extractors()
|
fltr = lambda c, bc: c in argv or bc in argv # noqa: E731
|
||||||
if extr.category in sys.argv or
|
|
||||||
hasattr(extr, "basecategory") and extr.basecategory in sys.argv
|
|
||||||
]
|
|
||||||
del sys.argv[1:]
|
del sys.argv[1:]
|
||||||
else:
|
else:
|
||||||
extractors = [
|
skip = BROKEN.copy()
|
||||||
extr for extr in extractor.extractors()
|
if "CI" in os.environ and "TRAVIS" in os.environ:
|
||||||
if extr.category not in SKIP
|
skip |= TRAVIS_SKIP
|
||||||
]
|
print("skipping:", ", ".join(skip))
|
||||||
|
fltr = lambda c, bc: c not in skip # noqa: E731
|
||||||
|
|
||||||
|
# filter available extractor classes
|
||||||
|
extractors = [
|
||||||
|
extr for extr in extractor.extractors()
|
||||||
|
if fltr(
|
||||||
|
extr.category,
|
||||||
|
extr.basecategory if hasattr(extr, "basecategory") else None
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
# add 'test_...' methods to TestExtractors
|
||||||
for extr in extractors:
|
for extr in extractors:
|
||||||
if not hasattr(extr, "test") or not extr.test:
|
if not hasattr(extr, "test") or not extr.test:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user