aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_downloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_downloader.py')
-rw-r--r--test/test_downloader.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/test_downloader.py b/test/test_downloader.py
index f88b2c0..35cccc4 100644
--- a/test/test_downloader.py
+++ b/test/test_downloader.py
@@ -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()