diff options
| author | Kevin Brown <kevin@kevinbrown.in> | 2014-07-13 15:41:15 -0400 |
|---|---|---|
| committer | Kevin Brown <kevin@kevinbrown.in> | 2014-07-13 15:41:15 -0400 |
| commit | b6c493deb2341fb843d71b66b2aa23078638755c (patch) | |
| tree | db4695c1056b41136180c9cef8fdf4342e499862 /gitdb/test/db | |
| parent | 1c6f4c19289732bd13507eba9e54c9d692957137 (diff) | |
| download | gitdb-b6c493deb2341fb843d71b66b2aa23078638755c.tar.gz | |
Pick off the low hanging fruit
This fixes most of the import errors that came from using the
implicit relative imports that Python 2 supports. This also fixes
the use of `xrange`, which has replaced `range` in Python 3. The
same has happened for `izip`, which is also being aliased.
The octal number syntax changed in Python 3, so we are now
converting from strings using the `int` built-in function, which
will produce the same output across both versions of Python.
Diffstat (limited to 'gitdb/test/db')
| -rw-r--r-- | gitdb/test/db/lib.py | 12 | ||||
| -rw-r--r-- | gitdb/test/db/test_git.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_loose.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_mem.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_pack.py | 2 | ||||
| -rw-r--r-- | gitdb/test/db/test_ref.py | 2 |
6 files changed, 15 insertions, 7 deletions
diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index dc89039..18b22ff 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -23,7 +23,15 @@ from gitdb.exc import BadObject from gitdb.typ import str_blob_type from async import IteratorReader -from cStringIO import StringIO + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO + from struct import pack @@ -40,7 +48,7 @@ class TestDBBase(TestBase): # write a bunch of objects and query their streams and info null_objs = db.size() ni = 250 - for i in xrange(ni): + for i in range(ni): data = pack(">L", i) istream = IStream(str_blob_type, len(data), StringIO(data)) new_istream = db.store(istream) diff --git a/gitdb/test/db/test_git.py b/gitdb/test/db/test_git.py index 4894c6a..cce2b9c 100644 --- a/gitdb/test/db/test_git.py +++ b/gitdb/test/db/test_git.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.exc import BadObject from gitdb.db import GitDB from gitdb.base import OStream, OInfo diff --git a/gitdb/test/db/test_loose.py b/gitdb/test/db/test_loose.py index e295db5..5e42b63 100644 --- a/gitdb/test/db/test_loose.py +++ b/gitdb/test/db/test_loose.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import LooseObjectDB from gitdb.exc import BadObject from gitdb.util import bin_to_hex diff --git a/gitdb/test/db/test_mem.py b/gitdb/test/db/test_mem.py index ac9bc34..9235b21 100644 --- a/gitdb/test/db/test_mem.py +++ b/gitdb/test/db/test_mem.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import ( MemoryDB, LooseObjectDB diff --git a/gitdb/test/db/test_pack.py b/gitdb/test/db/test_pack.py index 0d9110a..f5a4dcb 100644 --- a/gitdb/test/db/test_pack.py +++ b/gitdb/test/db/test_pack.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import PackedDB from gitdb.test.lib import fixture_path diff --git a/gitdb/test/db/test_ref.py b/gitdb/test/db/test_ref.py index 0864468..752c31d 100644 --- a/gitdb/test/db/test_ref.py +++ b/gitdb/test/db/test_ref.py @@ -2,7 +2,7 @@ # # This module is part of GitDB and is released under # the New BSD License: http://www.opensource.org/licenses/bsd-license.php -from lib import * +from gitdb.test.db.lib import * from gitdb.db import ReferenceDB from gitdb.util import ( |
