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:
parent
60b655429f
commit
510ca36b35
@ -45,11 +45,15 @@ 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):
|
||||
del sys.modules["youtube_dl"]
|
||||
if cls._orig_ytdl:
|
||||
sys.modules["youtube_dl"] = cls._orig_ytdl
|
||||
else:
|
||||
del sys.modules["youtube_dl"]
|
||||
|
||||
def tearDown(self):
|
||||
downloader._cache.clear()
|
||||
|
Loading…
Reference in New Issue
Block a user