diff options
| author | Kevin Brown <kevin@kevinbrown.in> | 2014-07-16 20:15:31 -0400 |
|---|---|---|
| committer | Kevin Brown <kevin@kevinbrown.in> | 2014-07-16 20:15:31 -0400 |
| commit | 0465cf327d232101b2de69d714a468b7e1a66a74 (patch) | |
| tree | 91cc5e78c8c065321ccf23e048deb7403ec54c59 /gitdb/test | |
| parent | 0cf09d3310cba7f33b9ebc9badf61ab721d12857 (diff) | |
| download | gitdb-0465cf327d232101b2de69d714a468b7e1a66a74.tar.gz | |
Start up compat and encoding files
There were a few things which were being reused consistently for
compatibility purposes, such as the `buffer`/`memoryview` functions
as well as the `izip` method which needed to be aliased for
Python 3. The `buffer` function was taken from `smmap` [1] and
reworked slightly to handle the optional third parameter.
This also adds a compatibility file dedicated entirely to encoding
issues, which seem to be the biggest problem. The main functions
were taken in part from the Django project [2] and rewritten
slightly because our needs are a bit more narrow.
A constants file has been added to consistently handle the
constants which are required for the gitdb project in the core
and the tests. This is part of a greater plan to reorganize
the `util.py` file included in this project.
This points the async extension back at the original repository
and points it to the latest commit.
[1]: https://github.com/Byron/smmap/blob/1af4b42a2354acbb53c7956d647655922658fd80/smmap/util.py#L20-L26
[2]: https://github.com/django/django/blob/b8d255071ead897cf68120cd2fae7c91326ca2cc/django/utils/encoding.py
Diffstat (limited to 'gitdb/test')
| -rw-r--r-- | gitdb/test/db/lib.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/gitdb/test/db/lib.py b/gitdb/test/db/lib.py index a6cdbbe..d0028b8 100644 --- a/gitdb/test/db/lib.py +++ b/gitdb/test/db/lib.py @@ -35,7 +35,7 @@ class TestDBBase(TestBase): """Base class providing testing routines on databases""" # data - two_lines = "1234\nhello world".encode("ascii") + two_lines = "1234\nhello world" all_data = (two_lines, ) def _assert_object_writing_simple(self, db): @@ -81,8 +81,7 @@ class TestDBBase(TestBase): prev_ostream = db.set_ostream(ostream) assert type(prev_ostream) in ostreams or prev_ostream in ostreams - - istream = IStream(str_blob_type, len(data), BytesIO(data)) + istream = IStream(str_blob_type, len(data), BytesIO(data.encode("ascii"))) # store returns same istream instance, with new sha set my_istream = db.store(istream) @@ -131,8 +130,7 @@ class TestDBBase(TestBase): """Test generic object writing using asynchronous access""" ni = 5000 def istream_generator(offset=0, ni=ni): - for data_src in xrange(ni): - print(type(data_src), type(offset)) + for data_src in range(ni): data = bytes(data_src + offset) yield IStream(str_blob_type, len(data), BytesIO(data)) # END for each item |
