diff --git a/.travis.yml b/.travis.yml index 9f31e6fc3..07259cef8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: - "3.3" - "3.4" - "pypy" + - "pypy3" env: LIBGIT2=~/libgit2/_install/ LD_LIBRARY_PATH=~/libgit2/_install/lib diff --git a/test/test_commit.py b/test/test_commit.py index 00f81cd19..4a637f8e1 100644 --- a/test/test_commit.py +++ b/test/test_commit.py @@ -35,12 +35,15 @@ from pygit2 import GIT_OBJ_COMMIT, Signature, Oid from . import utils -# pypy raises TypeError on writing to read-only, so we need to check -# and change the test accordingly +# pypy (in python2 mode) raises TypeError on writing to read-only, so +# we need to check and change the test accordingly try: import __pypy__ + import __pypy__, sys + pypy2 = sys.version_info[0] < 3 except ImportError: __pypy__ = None + pypy2 = False COMMIT_SHA = '5fe808e8953c12735680c257f56600cb0de44b10' @@ -149,7 +152,7 @@ def test_modify_commit(self): commit = self.repo[COMMIT_SHA] - error_type = AttributeError if not __pypy__ else TypeError + error_type = AttributeError if not pypy2 else TypeError self.assertRaises(error_type, setattr, commit, 'message', message) self.assertRaises(error_type, setattr, commit, 'committer', committer) self.assertRaises(error_type, setattr, commit, 'author', author) diff --git a/test/test_tag.py b/test/test_tag.py index c8448686d..707ade0d4 100644 --- a/test/test_tag.py +++ b/test/test_tag.py @@ -34,12 +34,14 @@ import pygit2 from . import utils -# pypy raises TypeError on writing to read-only, so we need to check -# and change the test accordingly +# pypy (in python2 mode) raises TypeError on writing to read-only, so +# we need to check and change the test accordingly try: - import __pypy__ + import __pypy__, sys + pypy2 = sys.version_info[0] < 3 except ImportError: __pypy__ = None + pypy2 = False TAG_SHA = '3d2962987c695a29f1f80b6c3aa4ec046ef44369' @@ -90,7 +92,7 @@ def test_modify_tag(self): tagger = ('John Doe', 'jdoe@example.com', 12347) tag = self.repo[TAG_SHA] - error_type = AttributeError if not __pypy__ else TypeError + error_type = AttributeError if not pypy2 else TypeError self.assertRaises(error_type, setattr, tag, 'name', name) self.assertRaises(error_type, setattr, tag, 'target', target) self.assertRaises(error_type, setattr, tag, 'tagger', tagger)