Skip to content

Commit 7078c17

Browse files
committed
tests: gate more networked tests behind SKIP_DOWNLOADER_TESTS
1 parent bd033fb commit 7078c17

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

tests/TestGoodreadsSource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
# with this program. If not, see <http://www.gnu.org/licenses/>.
1616
### END LICENSE
1717

18+
import os
1819
import unittest
1920

2021
from jumble.Jumble import Jumble
2122

22-
23+
@unittest.skipIf(os.getenv("SKIP_DOWNLOADER_TESTS"), "Skipping downloader tests (SKIP_DOWNLOADER_TESTS is set)")
2324
class TestGoodreadsSource(unittest.TestCase):
2425
def test_get_for_author(self):
2526
p = Jumble(["variety/plugins/builtin"])

tests/TestImageFetcher.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# You should have received a copy of the GNU General Public License along
1515
# with this program. If not, see <http://www.gnu.org/licenses/>.
1616
### END LICENSE
17+
import os
1718
import os.path
1819
import shutil
1920
import unittest
@@ -23,6 +24,7 @@
2324

2425

2526
class TestImageFetcher(unittest.TestCase):
27+
@unittest.skipIf(os.getenv("SKIP_DOWNLOADER_TESTS"), "Skipping downloader tests (SKIP_DOWNLOADER_TESTS is set)")
2628
def test_fetch(self):
2729
target_folder = "/tmp/variety/ImageFetcher"
2830
shutil.rmtree(target_folder, ignore_errors=True)

tests/TestQuotationsPageSource.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
# with this program. If not, see <http://www.gnu.org/licenses/>.
1616
### END LICENSE
1717

18+
import os
1819
import unittest
1920

2021
from jumble.Jumble import Jumble
2122

22-
23+
@unittest.skipIf(os.getenv("SKIP_DOWNLOADER_TESTS"), "Skipping downloader tests (SKIP_DOWNLOADER_TESTS is set)")
2324
class TestQuotationsPageSource(unittest.TestCase):
2425
def test_get_random(self):
2526
p = Jumble(["variety/plugins/builtin"])

tests/TestUtil.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def f(i):
173173

174174
self.assertEqual([20, 30], list(Util.safe_map(f, [1, 5, 20, 10, 30, 4])))
175175

176+
@unittest.skipIf(os.getenv("SKIP_DOWNLOADER_TESTS"), "Skipping networked tests (SKIP_DOWNLOADER_TESTS is set)")
176177
def test_fetch(self):
177178
resp = Util.fetch("//google.com")
178179
self.assertTrue(len(resp) > 0)
@@ -198,6 +199,7 @@ def test_is_animated_gif(self):
198199
self.assertTrue(Util.is_animated_gif("animated.gif"))
199200
self.assertFalse(Util.is_animated_gif("not-animated.gif"))
200201

202+
@unittest.skipIf(os.getenv("SKIP_DOWNLOADER_TESTS"), "Skipping downloader tests (SKIP_DOWNLOADER_TESTS is set)")
201203
def test_is_dead_or_not_image(self):
202204
self.assertTrue(Util.is_dead_or_not_image(None))
203205
self.assertTrue(Util.is_dead_or_not_image("not a URL"))

0 commit comments

Comments
 (0)