From 3201d77a148367d739862b4f07868a76eaeb7cb1 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 13 Mar 2021 16:26:30 -0500 Subject: New upstream version 1.17.0. --- test/test_downloader.py | 8 ++++---- test/test_extractor.py | 4 ---- test/test_postprocessor.py | 4 ++-- test/test_results.py | 12 +----------- test/test_util.py | 12 +++++++++++- 5 files changed, 18 insertions(+), 22 deletions(-) (limited to 'test') diff --git a/test/test_downloader.py b/test/test_downloader.py index 99cfb62..42b5c72 100644 --- a/test/test_downloader.py +++ b/test/test_downloader.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2018-2020 Mike Fährmann +# Copyright 2018-2021 Mike Fährmann # # 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 @@ -74,7 +74,7 @@ class TestDownloaderModule(unittest.TestCase): self.assertEqual(downloader.find(1234) , None) self.assertEqual(downloader.find(None) , None) - @patch("importlib.import_module") + @patch("builtins.__import__") def test_cache(self, import_module): import_module.return_value = MockDownloaderModule() downloader.find("http") @@ -86,14 +86,14 @@ class TestDownloaderModule(unittest.TestCase): downloader.find("ytdl") self.assertEqual(import_module.call_count, 3) - @patch("importlib.import_module") + @patch("builtins.__import__") def test_cache_http(self, import_module): import_module.return_value = MockDownloaderModule() downloader.find("http") downloader.find("https") self.assertEqual(import_module.call_count, 1) - @patch("importlib.import_module") + @patch("builtins.__import__") def test_cache_https(self, import_module): import_module.return_value = MockDownloaderModule() downloader.find("https") diff --git a/test/test_extractor.py b/test/test_extractor.py index 8bc3a27..f04e1c7 100644 --- a/test/test_extractor.py +++ b/test/test_extractor.py @@ -219,10 +219,6 @@ class TestExtractorWait(unittest.TestCase): class TextExtractorOAuth(unittest.TestCase): - @classmethod - def setUpClass(cls): - mastodon.generate_extractors() - def test_oauth1(self): for category in ("flickr", "smugmug", "tumblr"): extr = extractor.find("oauth:" + category) diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py index 4e98a97..6bf887c 100644 --- a/test/test_postprocessor.py +++ b/test/test_postprocessor.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2019-2020 Mike Fährmann +# Copyright 2019-2021 Mike Fährmann # # 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 @@ -53,7 +53,7 @@ class TestPostprocessorModule(unittest.TestCase): self.assertEqual(postprocessor.find(1234) , None) self.assertEqual(postprocessor.find(None) , None) - @patch("importlib.import_module") + @patch("builtins.__import__") def test_cache(self, import_module): import_module.return_value = MockPostprocessorModule() diff --git a/test/test_results.py b/test/test_results.py index f7356d5..223ef57 100644 --- a/test/test_results.py +++ b/test/test_results.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2015-2020 Mike Fährmann +# Copyright 2015-2021 Mike Fährmann # # 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 @@ -20,14 +20,6 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from gallery_dl import extractor, util, job, config, exception # noqa E402 -# these don't work on Travis CI -TRAVIS_SKIP = { - "exhentai", "mangafox", "dynastyscans", "nijie", "instagram", "ngomik", - "archivedmoe", "archiveofsins", "thebarchive", "fireden", "4plebs", - "sankaku", "idolcomplex", "mangahere", "mangadex", "sankakucomplex", - "warosu", "fuskator", "patreon", "komikcast", "twitter", -} - # temporary issues, etc. BROKEN = { "imagevenue", @@ -361,8 +353,6 @@ def generate_tests(): del sys.argv[1:] else: skip = set(BROKEN) - if "CI" in os.environ and "TRAVIS" in os.environ: - skip |= set(TRAVIS_SKIP) if skip: print("skipping:", ", ".join(skip)) fltr = lambda c, bc: c not in skip # noqa: E731 diff --git a/test/test_util.py b/test/test_util.py index 8848ea0..06de735 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2015-2020 Mike Fährmann +# Copyright 2015-2021 Mike Fährmann # # 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 @@ -461,6 +461,16 @@ class TestOther(unittest.TestCase): self.assertSequenceEqual( list(util.unique([1, 2, 1, 3, 2, 1])), [1, 2, 3]) + def test_unique_sequence(self): + self.assertSequenceEqual( + list(util.unique_sequence("")), "") + self.assertSequenceEqual( + list(util.unique_sequence("AABBCC")), "ABC") + self.assertSequenceEqual( + list(util.unique_sequence("ABABABCAABBCC")), "ABABABCABC") + self.assertSequenceEqual( + list(util.unique_sequence([1, 2, 1, 3, 2, 1])), [1, 2, 1, 3, 2, 1]) + def test_raises(self): func = util.raises(Exception) with self.assertRaises(Exception): -- cgit v1.2.3