[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Move test_parse_descriptors.py SkipTest to setUp().



commit 21e571b8e53062cb62e5c1023f434aa117c3d3b7
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Sun Jul 6 19:19:01 2014 +0000

    Move test_parse_descriptors.py SkipTest to setUp().
---
 lib/bridgedb/test/test_parse_descriptors.py |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py
index 84129d9..c085a9c 100644
--- a/lib/bridgedb/test/test_parse_descriptors.py
+++ b/lib/bridgedb/test/test_parse_descriptors.py
@@ -133,14 +133,15 @@ feWndKJk/zj5ZtkMND8VVbWuJE+R6Jh2Q3L0p8IZ6J4=
 class ParseDescriptorsTests(unittest.TestCase):
     """Unittests for :class:`bridgedb.parse.descriptors` module."""
 
-    def test_parse_descriptors_parseBridgeDescriptorsFile(self):
-        """Test for ``b.p.descriptors.parseBridgeDescriptorsFile``."""
-        if not HAS_STEM:
-            self.skip = True
-            raise unittest.SkipTest("Couldn't import Stem.")
+    skip = True if not HAS_STEM else False
 
-        from bridgedb.parse import descriptors
+    def setUp(self):
+        """Test if we have Stem installed. Skip these tests if it's missing."""
+        if self.skip:
+            raise unittest.SkipTest("Couldn't import Stem.")
 
+    def test_parse_descriptors_parseBridgeDescriptorsFile(self):
+        """Test for ``b.p.descriptors.parseBridgeDescriptorsFile``."""
         descFile = io.BytesIO(BRIDGE_SERVER_DESCRIPTOR)
         routers = descriptors.parseServerDescriptorsFile(descFile)
         self.assertIsInstance(routers, list)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits