[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"""
|
||||
category = "powermanga"
|
||||
pattern = foolslide.chapter_pattern(r"read(?:er)?\.powermanga\.org")
|
||||
test = [("https://read.powermanga.org/read/one_piece/en/0/803/page/1", {
|
||||
"url": "e6179c1565068f99180620281f86bdd25be166b4",
|
||||
"keyword": "224cab1f946d976ddbe4ef88fa1c02303699910b",
|
||||
test = [(("https://read.powermanga.org"
|
||||
"/read/one_piece_digital_colour_comics/en/0/75/"), {
|
||||
"url": "854c5817f8f767e1bccd05fa9d58ffb5a4b09384",
|
||||
"keyword": "9bf211d435060d1e38d3d13e4aaaa5a87381bfad",
|
||||
})]
|
||||
|
||||
|
||||
@@ -25,7 +26,8 @@ class PowermangaMangaExtractor(foolslide.FoolslideMangaExtractor):
|
||||
"""Extractor for manga from powermanga.org"""
|
||||
category = "powermanga"
|
||||
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",
|
||||
"keyword": {
|
||||
"chapter": int,
|
||||
@@ -34,7 +36,7 @@ class PowermangaMangaExtractor(foolslide.FoolslideMangaExtractor):
|
||||
"group": "PowerManga",
|
||||
"lang": "en",
|
||||
"language": "English",
|
||||
"manga": "One Piece",
|
||||
"manga": "One Piece Digital Colour Comics",
|
||||
"title": str,
|
||||
"volume": int,
|
||||
},
|
||||
|
||||
@@ -7,22 +7,21 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from gallery_dl import extractor, job, config, exception
|
||||
|
||||
|
||||
SKIP = {
|
||||
# don't work on travis-ci
|
||||
# these don't work on travis-ci
|
||||
TRAVIS_SKIP = {
|
||||
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie",
|
||||
"archivedmoe", "archiveofsins", "thebarchive",
|
||||
}
|
||||
|
||||
# temporary issues
|
||||
"imgcandy",
|
||||
"imgchili",
|
||||
"imgtrex",
|
||||
"powermanga",
|
||||
"puremashiro",
|
||||
# temporary issues, etc.
|
||||
BROKEN = {
|
||||
"puremashiro", # online reader down
|
||||
}
|
||||
|
||||
|
||||
@@ -134,20 +133,30 @@ def generate_tests():
|
||||
# enable selective testing for direct calls
|
||||
if __name__ == '__main__' and len(sys.argv) > 1:
|
||||
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:
|
||||
extractors = [
|
||||
extr for extr in extractor.extractors()
|
||||
if extr.category in sys.argv or
|
||||
hasattr(extr, "basecategory") and extr.basecategory in sys.argv
|
||||
]
|
||||
argv = sys.argv[1:]
|
||||
fltr = lambda c, bc: c in argv or bc in argv # noqa: E731
|
||||
del sys.argv[1:]
|
||||
else:
|
||||
extractors = [
|
||||
extr for extr in extractor.extractors()
|
||||
if extr.category not in SKIP
|
||||
]
|
||||
skip = BROKEN.copy()
|
||||
if "CI" in os.environ and "TRAVIS" in os.environ:
|
||||
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:
|
||||
if not hasattr(extr, "test") or not extr.test:
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user