[tor-commits] [bridgedb/master] Fix queue import

phw at torproject.org phw at torproject.org
Wed Feb 19 18:26:37 UTC 2020


commit 6ec43aeb660d7e51e5fc6ba392f96172510e5ac0
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Jan 11 14:05:50 2020 -0800

    Fix queue import
    
    Python 3.x changed its queue module name. This fixes...
    
      Traceback (most recent call last):
        File "/usr/local/lib/python3.5/dist-packages/twisted/trial/runner.py", line 823, in loadByName
          return self.suiteFactory([self.findByName(name, recurse=recurse)])
        ...
        File "./bridgedb/test/test_smtp.py", line 8, in <module>
          import Queue
      builtins.ImportError: No module named 'Queue'
    
    This changes test results as follows...
    
      before: FAILED (skips=103, failures=6, errors=183, successes=375)
      after:  FAILED (skips=106, failures=6, errors=182, successes=375)
---
 bridgedb/test/test_smtp.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bridgedb/test/test_smtp.py b/bridgedb/test/test_smtp.py
index de443b3..2a532b2 100644
--- a/bridgedb/test/test_smtp.py
+++ b/bridgedb/test/test_smtp.py
@@ -5,7 +5,7 @@ from __future__ import print_function
 import smtplib
 import asyncore
 import threading
-import Queue
+import queue
 import random
 import os
 
@@ -58,7 +58,7 @@ class EmailServer(SMTPServer):
         self.close()
 
     def start(self):
-        self.message_queue = Queue.Queue()
+        self.message_queue = queue.Queue()
         self._stop = threading.Event()
         self._thread = threading.Thread(target=self.thread_proc)
         # Ensures that if any tests do fail, then threads will exit when the
@@ -93,7 +93,7 @@ class EmailServer(SMTPServer):
         # failures:
         #
         # https://travis-ci.org/isislovecruft/bridgedb/jobs/58996136#L3281
-        except Queue.Empty:
+        except queue.Empty:
             pass
         else:
             assert message.find(text) != -1, ("Message did not contain text '%s'."
@@ -103,7 +103,7 @@ class EmailServer(SMTPServer):
     def checkNoMessageReceived(self, timeoutInSecs=2.0):
         try:
             self.message_queue.get(block=True, timeout=timeoutInSecs)
-        except Queue.Empty:
+        except queue.Empty:
             return True
         assert False, "Found a message in the queue, but expected none"
 





More information about the tor-commits mailing list