Mike Bayer committed 6e040f3

fix py3k imports

Comments (0)

Files changed (3)


     tounicode = unicode
-if py3k:
-    import configparser
-    import ConfigParser as configparser
 def coerce_string_conf(d):
     result = {}


     except except_cls as e:
         assert, str(e)), "%r !~ %s" % (msg, e)
+from dogpile.cache.util import py3k
+if py3k:
+    import configparser
+    import io
+    import ConfigParser as configparser
+    import StringIO as io


 from unittest import TestCase
 from dogpile.cache.api import CacheBackend, CachedValue, NO_VALUE
 from dogpile.cache import make_region, register_backend, CacheRegion, util
-from . import eq_, assert_raises_message
+from . import eq_, assert_raises_message, io, configparser
 import time
 import itertools
         my_region = make_region()
-        import StringIO
-        config = util.configparser.ConfigParser()
-        config.readfp(StringIO.StringIO(my_conf))
+        config = configparser.ConfigParser()
+        config.readfp(io.StringIO(my_conf))
         my_region.configure_from_config(dict(config.items('xyz')), 'cache.example.')
         eq_(my_region.expiration_time, 600)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.