[tor-commits] [bridgedb/master] Context manager class is now private

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


commit c484f6553da7bedeeb42cac724687620968e5f16
Author: Damian Johnson <atagar at torproject.org>
Date:   Fri Jan 10 14:11:39 2020 -0800

    Context manager class is now private
    
    BridgeDB shouldn't use GeneratorContextManager, but if it does this class is
    now under a new name...
    
      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_Storage.py", line 13, in <module>
          import bridgedb.Storage as Storage
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/Storage.py", line 11, in <module>
          from contextlib import GeneratorContextManager
      builtins.ImportError: cannot import name 'GeneratorContextManager'
    
    This still doesn't change test outcome due to further Storage.py issues...
    
      before: FAILED (skips=1, failures=7, errors=49, successes=255)
      after:  FAILED (skips=1, failures=7, errors=49, successes=255)
---
 bridgedb/Storage.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bridgedb/Storage.py b/bridgedb/Storage.py
index 3cc6c09..c7385ba 100644
--- a/bridgedb/Storage.py
+++ b/bridgedb/Storage.py
@@ -8,7 +8,7 @@ import binascii
 import sqlite3
 import time
 import hashlib
-from contextlib import GeneratorContextManager
+from contextlib import _GeneratorContextManager
 from functools import wraps
 from ipaddr import IPAddress
 import sys
@@ -345,7 +345,7 @@ def openDatabase(sqlite_file):
     return conn
 
 
-class DBGeneratorContextManager(GeneratorContextManager):
+class DBGeneratorContextManager(_GeneratorContextManager):
     """Helper for @contextmanager decorator.
 
     Overload __exit__() so we can call the generator many times





More information about the tor-commits mailing list