1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-21 18:22:30 +01:00

[tests] fix bug when running tests in a certain order

test_ytdl -> test_downloader -> test_extractor
would cause a test failure in Python <3.6 related to youtube_dl imports
This commit is contained in:
Mike Fährmann 2024-08-31 09:05:07 +02:00
parent 60b655429f
commit 510ca36b35
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -45,10 +45,14 @@ class TestDownloaderModule(unittest.TestCase):
@classmethod
def setUpClass(cls):
# allow import of ytdl downloader module without youtube_dl installed
cls._orig_ytdl = sys.modules.get("youtube_dl")
sys.modules["youtube_dl"] = MagicMock()
@classmethod
def tearDownClass(cls):
if cls._orig_ytdl:
sys.modules["youtube_dl"] = cls._orig_ytdl
else:
del sys.modules["youtube_dl"]
def tearDown(self):