[Python-modules-commits] [sorl-thumbnail] 03/15: Disable HTTP requests during build

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 5 01:39:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository sorl-thumbnail.

commit 8d83ae645900b535160dbe3becc7c0cc651b13cd
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Thu Oct 8 13:53:16 2015 -0700

    Disable HTTP requests during build
    
     Remote resources such as images fetched over HTTP are not allowed at build
     time so this patch skips these tests if the environment variable
     LOCAL_BUILD is present.
    Last-Update: 2015-01-27
    Forwarded: not-needed
    
    Patch-Name: disable_http_tests.patch
---
 tests/thumbnail_tests/test_engines.py      | 13 +++++++------
 tests/thumbnail_tests/test_templatetags.py |  2 ++
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/thumbnail_tests/test_engines.py b/tests/thumbnail_tests/test_engines.py
index 4ef4617..da6a86a 100644
--- a/tests/thumbnail_tests/test_engines.py
+++ b/tests/thumbnail_tests/test_engines.py
@@ -192,12 +192,13 @@ class SimpleTestCase(BaseTestCase):
             default.kvstore.get(im).serialize_storage(),
             'tests.thumbnail_tests.storage.TestStorage',
         )
-        im = ImageFile('http://dummyimage.com/300x300/')
-        default.kvstore.set(im)
-        self.assertEqual(
-            default.kvstore.get(im).serialize_storage(),
-            'sorl.thumbnail.images.UrlStorage',
-        )
+        if not os.environ.get('LOCAL_BUILD', False):
+            im = ImageFile('http://dummyimage.com/300x300/')
+            default.kvstore.set(im)
+            self.assertEqual(
+                default.kvstore.get(im).serialize_storage(),
+                'sorl.thumbnail.images.UrlStorage',
+            )
 
     def test_abspath(self):
         item = Item.objects.get(image='500x500.jpg')
diff --git a/tests/thumbnail_tests/test_templatetags.py b/tests/thumbnail_tests/test_templatetags.py
index d545519..0dbef1e 100644
--- a/tests/thumbnail_tests/test_templatetags.py
+++ b/tests/thumbnail_tests/test_templatetags.py
@@ -146,10 +146,12 @@ class TemplateTestCaseA(BaseTestCase):
 
 
 class TemplateTestCaseB(BaseTestCase):
+    @unittest.skipIf(os.environ.get('LOCAL_BUILD', False), "No remote resources desired")
     def test_url(self):
         val = render_to_string('thumbnail3.html', {}).strip()
         self.assertEqual(val, '<img style="margin:0px 0px 0px 0px" width="20" height="20">')
 
+    @unittest.skipIf(os.environ.get('LOCAL_BUILD', False), "No remote resources desired")
     def test_portrait(self):
         val = render_to_string('thumbnail4.html', {
             'source': 'http://dummyimage.com/120x100/',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sorl-thumbnail.git



More information about the Python-modules-commits mailing list