[Python-modules-commits] [ldif3] 06/09: Skip tests that require network connectivity.

Michael Fladischer fladi at moszumanska.debian.org
Fri Mar 17 08:26:20 UTC 2017


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

fladi pushed a commit to branch master
in repository ldif3.

commit 3b9c19a6df51cd27f7e3685754ef6c63449bc22f
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Mar 17 09:10:14 2017 +0100

    Skip tests that require network connectivity.
    
    By setting the environment NO_NETWOrK to any value some tests get skipped that
    would otherwise fail because of the missing network connection.
---
 tests.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests.py b/tests.py
index 2647c97..edd5c12 100644
--- a/tests.py
+++ b/tests.py
@@ -2,6 +2,7 @@
 
 from __future__ import unicode_literals
 
+import os
 import unittest
 
 try:
@@ -13,6 +14,8 @@ from io import BytesIO
 
 import ldif3
 
+NO_NETWORK = 'NO_NETWORK' in os.environ
+
 
 BYTES = b"""version: 1
 dn: cn=Alice Alison,
@@ -229,15 +232,18 @@ class TestLDIFParser(unittest.TestCase):
         self.assertEqual(attr_type, 'foo')
         self.assertEqual(attr_value, 'a\nb\nc')
 
+    @unittest.skipIf(NO_NETWORK, 'No network connectivity available')
     def test_parse_attr_url(self):
         self.p._process_url_schemes = [b'https']
         attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n')
         self.assertIn(URL_CONTENT, attr_value)
 
+    @unittest.skipIf(NO_NETWORK, 'No network connectivity available')
     def test_parse_attr_url_all_ignored(self):
         attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n')
         self.assertEqual(attr_value, '')
 
+    @unittest.skipIf(NO_NETWORK, 'No network connectivity available')
     def test_parse_attr_url_this_ignored(self):
         self.p._process_url_schemes = [b'file']
         attr_type, attr_value = self.p._parse_attr(b'foo:< ' + URL + b'\n')

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



More information about the Python-modules-commits mailing list