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

[tor-commits] [stem/master] Unit tests failed if bz2 unavailable



commit 6a66ccc33057634137211f0d3f57decf2b4199f3
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun May 28 15:25:30 2017 -0700

    Unit tests failed if bz2 unavailable
    
    Python has bz2 built in but when python's compiled it omits bz2 by default.
    This causes our tests to fail with...
    
      ======================================================================
      FAIL: test_archived_bz2
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/atagar/Desktop/stem/test/unit/descriptor/reader.py", line 404, in test_archived_bz2
          self.assertEqual(expected_results, read_descriptors)
      AssertionError: Lists differ: ['router Amunet1 199.48.147.35 443 0 80\np[7520 chars]-\n'] != []
    
      First list contains 3 additional elements.
      First extra element 0:
      'router Amunet1 199.48.147.35 443 0 80\nplatform Tor 0.2.2.34 (git-f0e1ee98af443107) on Linux x86_64...
    
      Diff is 9261 characters long. Set self.maxDiff to None to see it.
    
      ----------------------------------------------------------------------
      Ran 27 tests in 0.115s
---
 test/settings.cfg              | 1 +
 test/unit/descriptor/reader.py | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/test/settings.cfg b/test/settings.cfg
index b65ee37..5740f1b 100644
--- a/test/settings.cfg
+++ b/test/settings.cfg
@@ -160,6 +160,7 @@ pyflakes.ignore stem/interpreter/__init__.py => undefined name 'raw_input'
 pyflakes.ignore stem/util/conf.py => undefined name 'unicode'
 pyflakes.ignore stem/util/test_tools.py => 'pyflakes' imported but unused
 pyflakes.ignore stem/util/test_tools.py => 'pycodestyle' imported but unused
+pyflakes.ignore test/unit/descriptor/reader.py => 'bz2' imported but unused
 pyflakes.ignore test/unit/response/events.py => 'from stem import *' used; unable to detect undefined names
 pyflakes.ignore test/unit/response/events.py => *may be undefined, or defined from star imports: stem
 pyflakes.ignore test/__init__.py => undefined name 'test'
diff --git a/test/unit/descriptor/reader.py b/test/unit/descriptor/reader.py
index ad6a425..e450f7c 100644
--- a/test/unit/descriptor/reader.py
+++ b/test/unit/descriptor/reader.py
@@ -396,6 +396,13 @@ class TestDescriptorReader(unittest.TestCase):
     Checks that we can read descriptors from an bzipped archive.
     """
 
+    # when python's compiled it only optionally has bz2 support
+
+    try:
+      import bz2
+    except ImportError:
+      self.skipTest('(bz2 unsupported}')
+
     expected_results = _get_raw_tar_descriptors()
     test_path = os.path.join(DESCRIPTOR_TEST_DATA, 'descriptor_archive.tar.bz2')
 



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