From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sun, 14 Apr 2019 19:57:46 +0200
Subject: Allow one to disable certain tests that depend on networking.

---
 tests/test_pybadges.py | 7 +++++++
 1 file changed, 7 insertions(+)

--- a/tests/test_pybadges.py
+++ b/tests/test_pybadges.py
@@ -16,6 +16,7 @@
 import base64
 import doctest
 import json
+import os
 import os.path
 import pathlib
 import sys
@@ -26,6 +27,8 @@
 import pybadges
 from tests import image_server
 
+DISABLE_NETWORK = 'DISABLE_NETWORK' in os.environ
+
 TEST_DIR = os.path.dirname(__file__)
 
 PNG_IMAGE_B64 = (
@@ -56,6 +59,7 @@
                            left_link='http://example.com/',
                            whole_link='http://example.com/')
 
+    @unittest.skipIf(DISABLE_NETWORK, 'Network disabled')
     def test_changes(self):
         with open(os.path.join(TEST_DIR, 'test-badges.json'), 'r') as f:
             examples = json.load(f)
@@ -100,11 +104,13 @@
         url = 'data:image/png;base64,' + PNG_IMAGE_B64
         self.assertEqual(url, pybadges._embed_image(url))
 
+    @unittest.skipIf(DISABLE_NETWORK, 'Network disabled')
     def test_http_url(self):
         url = 'https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/python.svg'
         self.assertRegex(pybadges._embed_image(url),
                          r'^data:image/svg(\+xml)?;base64,')
 
+    @unittest.skipIf(DISABLE_NETWORK, 'Network disabled')
     def test_not_image_url(self):
         with self.assertRaisesRegex(ValueError,
                                     'expected an image, got "text"'):
