remove extractor/test.py (#4504)

This commit is contained in:
Mike Fährmann
2024-02-27 01:37:57 +01:00
parent fde9e25c9f
commit 8a11b72253
8 changed files with 11 additions and 121 deletions

View File

@@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
from gallery_dl.extractor import test
__tests__ = (
{
"#url" : "test:pixiv",
"#category": ("", "test", ""),
"#class" : test.TestExtractor,
},
{
"#url" : "test:pixiv:user,favorite:0",
"#category": ("", "test", ""),
"#class" : test.TestExtractor,
},
{
"#url" : "test:",
"#category": ("", "test", ""),
"#class" : test.TestExtractor,
},
)

View File

@@ -63,7 +63,7 @@ class TestCookiejar(unittest.TestCase):
def _test_warning(self, filename, exc):
config.set((), "cookies", filename)
log = logging.getLogger("test")
log = logging.getLogger("generic")
with mock.patch.object(log, "warning") as mock_warning:
cookies = _get_extractor("test").cookies
@@ -173,7 +173,7 @@ class TestCookieUtils(unittest.TestCase):
self.assertFalse(extr.cookies_domain, "empty")
now = int(time.time())
log = logging.getLogger("test")
log = logging.getLogger("generic")
extr.cookies.set("a", "1", expires=now-100)
with mock.patch.object(log, "warning") as mw:
@@ -212,7 +212,7 @@ URLS = {
"idolcomplex": "https://idol.sankakucomplex.com/post/show/1",
"nijie" : "https://nijie.info/view.php?id=1",
"horne" : "https://horne.red/view.php?id=1",
"test" : "test:",
"test" : "generic:https://example.org/",
}

View File

@@ -33,7 +33,7 @@ class MockDownloaderModule(Mock):
class FakeJob():
def __init__(self):
self.extractor = extractor.find("test:")
self.extractor = extractor.find("generic:https://example.org/")
self.extractor.initialize()
self.pathfmt = path.PathFormat(self.extractor)
self.out = output.NullOutput()

View File

@@ -45,7 +45,7 @@ class TestExtractorModule(unittest.TestCase):
"https://example.org/file.jpg",
"tumblr:foobar",
"oauth:flickr",
"test:pixiv:",
"generic:https://example.org/",
"recursive:https://example.org/document.html",
)
@@ -208,7 +208,7 @@ class TestExtractorModule(unittest.TestCase):
class TestExtractorWait(unittest.TestCase):
def test_wait_seconds(self):
extr = extractor.find("test:")
extr = extractor.find("generic:https://example.org/")
seconds = 5
until = time.time() + seconds
@@ -222,7 +222,7 @@ class TestExtractorWait(unittest.TestCase):
self._assert_isotime(calls[0][1][1], until)
def test_wait_until(self):
extr = extractor.find("test:")
extr = extractor.find("generic:https://example.org/")
until = time.time() + 5
with patch("time.sleep") as sleep, patch.object(extr, "log") as log:
@@ -237,7 +237,7 @@ class TestExtractorWait(unittest.TestCase):
self._assert_isotime(calls[0][1][1], until)
def test_wait_until_datetime(self):
extr = extractor.find("test:")
extr = extractor.find("generic:https://example.org/")
until = datetime.utcnow() + timedelta(seconds=5)
until_local = datetime.now() + timedelta(seconds=5)

View File

@@ -30,7 +30,8 @@ class MockPostprocessorModule(Mock):
class FakeJob():
def __init__(self, extr=extractor.find("test:")):
def __init__(self, extr=extractor.find("generic:https://example.org/")):
extr.directory_fmt = ("{category}",)
self.extractor = extr
self.pathfmt = path.PathFormat(extr)
self.out = output.NullOutput()