From ae00fe452260aabc70bbaa209df6f9c49d049fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 6 Sep 2014 18:37:08 +0200 Subject: [PATCH 1/2] Add pypy3 to Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) 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 From 81104d4df2460096051e5dcbfc2c78a2ce85a36e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sat, 6 Sep 2014 19:04:39 +0200 Subject: [PATCH 2/2] pypy3 does not have the AttributeError/TypeError difference --- test/test_commit.py | 9 ++++++--- test/test_tag.py | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) 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)