[tor-commits] [stem/master] Avoid test_connections_by_ss flakyness from IOErrors

atagar at torproject.org atagar at torproject.org
Sat Nov 24 18:03:56 UTC 2018


commit f4536b70b88c5e67e1ead089a0188df09b3ef85d
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Nov 24 09:58:18 2018 -0800

    Avoid test_connections_by_ss flakyness from IOErrors
    
    Nick encountered another error from this test...
    
      ======================================================================
      ERROR: test_connections_by_ss
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/home/nickm/src/stem/test/integ/util/connection.py", line 50, in test_connections_by_ss
          self.check_resolver(Resolver.SS)
        File "/home/nickm/src/stem/test/require.py", line 58, in wrapped
          return func(self, *args, **kwargs)
        File "/home/nickm/src/stem/test/integ/util/connection.py", line 28, in check_resolver
          connections = get_connections(resolver, process_pid = runner.get_pid())
        File "/home/nickm/src/stem/stem/util/connection.py", line 300, in get_connections
          raise IOError('No results found using: %s' % resolver_command)
      IOError: No results found using: ss -nptu
    
      ----------------------------------------------------------------------
    
    I'm unsure why this test is so flaky for him. Earlier I attempted to mitigate
    this by catching OSErrors but on reflection what he was really getting were
    IOErrors. Python *said* it was an OSError but that's because python3 has made
    IOError an alias...
    
      https://stackoverflow.com/questions/29347790/difference-between-ioerror-and-oserror
    
    In Stem 2.x I should probably replace IOError throughout our codebase with
    OSError.
---
 test/integ/util/connection.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integ/util/connection.py b/test/integ/util/connection.py
index 933c5788..12ce8ac4 100644
--- a/test/integ/util/connection.py
+++ b/test/integ/util/connection.py
@@ -48,7 +48,7 @@ class TestConnection(unittest.TestCase):
   def test_connections_by_ss(self):
     try:
       self.check_resolver(Resolver.SS)
-    except OSError:
+    except (IOError, OSError):
       self.skipTest('(ticket 27479)')
 
   def test_connections_by_lsof(self):



More information about the tor-commits mailing list