Fix python3 compatibility in dulwich.greenthreads, enable travis testing. Fixes:...
authorJelmer Vernooij <jelmer@samba.org>
Sun, 24 Apr 2016 21:19:56 +0000 (21:19 +0000)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 24 Apr 2016 21:19:56 +0000 (21:19 +0000)
.travis.yml
dulwich/tests/test_greenthreads.py

index 762f6f2475cb5199849c24f8c76b1077bdff1f06..8105a429798ea784bd720deaada1e919ce25c4ae 100644 (file)
@@ -5,13 +5,13 @@ env:
 matrix:
   include:
     - python: "2.7"
-      env: TEST_REQUIRE="gevent geventhttpclient fastimport"
+      env: TEST_REQUIRE="gevent greenlet geventhttpclient fastimport"
     - python: "pypy"
       env: TEST_REQUIRE="fastimport"
     - python: "3.4"
-      env: TEST_REQUIRE="fastimport"
+      env: TEST_REQUIRE="gevent greenlet fastimport"
     - python: "3.5"
-      env: TEST_REQUIRE="fastimport"
+      env: TEST_REQUIRE="gevent greenlet fastimport"
 cache:
   directories:
     - $HOME/.cache/pip
index 7119dedcaa4b95d4eeaee71e93669e47c6bb6131..33ae0599c634ce91aa1ab73017ecb71455a0c69e 100644 (file)
@@ -51,14 +51,14 @@ if gevent_support:
 skipmsg = "Gevent library is not installed"
 
 def create_commit(marker=None):
-    blob = Blob.from_string('The blob content %s' % marker)
+    blob = Blob.from_string(b'The blob content %s' % marker)
     tree = Tree()
-    tree.add("thefile %s" % marker, 0o100644, blob.id)
+    tree.add(b"thefile %s" % marker, 0o100644, blob.id)
     cmt = Commit()
     cmt.tree = tree.id
-    cmt.author = cmt.committer = "John Doe <john@doe.net>"
-    cmt.message = "%s" % marker
-    tz = parse_timezone('-0200')[0]
+    cmt.author = cmt.committer = b"John Doe <john@doe.net>"
+    cmt.message = marker
+    tz = parse_timezone(b'-0200')[0]
     cmt.commit_time = cmt.author_time = int(time.time())
     cmt.commit_timezone = cmt.author_timezone = tz
     return cmt, tree, blob
@@ -67,7 +67,7 @@ def create_commit(marker=None):
 def init_store(store, count=1):
     ret = []
     for i in range(0, count):
-        objs = create_commit(marker=i)
+        objs = create_commit(marker=("%d" % i).encode('ascii'))
         for obj in objs:
             ret.append(obj)
             store.add_object(obj)
@@ -127,7 +127,7 @@ class TestGreenThreadsMissingObjectFinder(TestCase):
         self.assertEqual(len(finder.objects_to_send), self.cmt_amount)
 
         finder = GreenThreadsMissingObjectFinder(self.store,
-                                             wants[0:self.cmt_amount/2],
+                                             wants[0:int(self.cmt_amount/2)],
                                              wants)
         # sha_done will contains commit id and sha of blob refered in tree
         self.assertEqual(len(finder.sha_done), (self.cmt_amount/2)*2)