From df056cff66eea2ab61357fa5247bd519a239db62 Mon Sep 17 00:00:00 2001 From: Ian Delaney Date: Wed, 23 Jan 2013 16:20:51 +0000 Subject: tests.patch allowing pypy to pass testsuite, pypy support added, see upstream pypy.org/issue1380 (Portage version: 2.1.11.40/cvs/Linux x86_64, signed Manifest commit with key 0xB8072B0D) --- dev-python/hglib/ChangeLog | 7 +++- dev-python/hglib/files/hglib-0.3-tests.patch | 63 ++++++++++++++++++++++++++++ dev-python/hglib/hglib-0.3.ebuild | 11 +++-- 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 dev-python/hglib/files/hglib-0.3-tests.patch (limited to 'dev-python/hglib') diff --git a/dev-python/hglib/ChangeLog b/dev-python/hglib/ChangeLog index f8c00578663d..e6b418737fcf 100644 --- a/dev-python/hglib/ChangeLog +++ b/dev-python/hglib/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-python/hglib # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/hglib/ChangeLog,v 1.4 2013/01/22 13:43:21 idella4 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/hglib/ChangeLog,v 1.5 2013/01/23 16:20:50 idella4 Exp $ + + 23 Jan 2013; Ian Delaney +files/hglib-0.3-tests.patch, + hglib-0.3.ebuild: + tests.patch allowing pypy to pass testsuite, pypy support added, see upstream + pypy.org/issue1380 *hglib-0.3 (22 Jan 2013) diff --git a/dev-python/hglib/files/hglib-0.3-tests.patch b/dev-python/hglib/files/hglib-0.3-tests.patch new file mode 100644 index 000000000000..c75c51013720 --- /dev/null +++ b/dev-python/hglib/files/hglib-0.3-tests.patch @@ -0,0 +1,63 @@ +tests require a more generic method to open, close files to work with pypy +https://bugs.pypy.org/issue1380 +diff -ur python-hglib-0.3.orig/tests/test-import.py python-hglib-0.3/tests/test-import.py +--- tests/test-import.py 2012-07-01 17:11:01.000000000 +0800 ++++ tests/test-import.py 2013-01-23 23:44:12.389473396 +0800 +@@ -22,7 +22,8 @@ + self.assertEquals(self.client.cat(['a']), '1\n') + + def test_basic_file(self): +- open('patch', 'wb').write(patch) ++ with open('patch', 'wb') as f: ++ f.write(patch) + + # --no-commit + self.client.import_(['patch'], nocommit=True) +diff -ur python-hglib-0.3.orig/tests/test-config.py python-hglib-0.3/tests/test-config.py +--- tests/test-config.py 2012-07-01 17:11:01.000000000 +0800 ++++ tests/test-config.py 2013-01-23 23:55:06.120502085 +0800 +@@ -3,7 +3,8 @@ + class test_config(common.basetest): + def setUp(self): + common.basetest.setUp(self) +- open('.hg/hgrc', 'a').write('[section]\nkey=value\n') ++ with open('.hg/hgrc', 'a') as f: ++ f.write('[section]\nkey=value\n') + self.client = hglib.open() + + def test_basic(self): +diff -ur python-hglib-0.3.orig/tests/test-paths.py python-hglib-0.3/tests/test-paths.py +--- tests/test-paths.py 2012-07-01 17:11:01.000000000 +0800 ++++ tests/test-paths.py 2013-01-24 00:04:36.266527106 +0800 +@@ -3,8 +3,8 @@ + + class test_paths(common.basetest): + def test_basic(self): +- open('.hg/hgrc', 'a').write('[paths]\nfoo = bar\n') +- ++ with open('.hg/hgrc', 'a') as f: ++ f.write('[paths]\nfoo = bar\n') + # hgrc isn't watched for changes yet, have to reopen + self.client = hglib.open() + paths = self.client.paths() +diff -ur python-hglib-0.3.orig/tests/test-update.py python-hglib-0.3/tests/test-update.py +--- tests/test-update.py 2012-11-09 18:56:31.000000000 +0800 ++++ tests/test-update.py 2013-01-24 00:05:40.866529942 +0800 +@@ -33,7 +33,8 @@ + self.client.commit('fourth') + self.client.update(rev2) + old = open('a').read() +- open('a', 'wb').write('a' + old) ++ with open('a', 'wb') as f: ++ f.write('a' + old) + u, m, r, ur = self.client.update() + self.assertEquals(u, 0) + self.assertEquals(m, 1) +@@ -68,5 +69,6 @@ + self.assertEquals(old, open('a').read()) + + def test_basic_plain(self): +- open('.hg/hgrc', 'a').write('[defaults]\nupdate=-v\n') ++ with open('.hg/hgrc', 'a') as f: ++ f.write('[defaults]\nupdate=-v\n') + self.test_basic() diff --git a/dev-python/hglib/hglib-0.3.ebuild b/dev-python/hglib/hglib-0.3.ebuild index 61c26744a1fa..35942d3667d7 100644 --- a/dev-python/hglib/hglib-0.3.ebuild +++ b/dev-python/hglib/hglib-0.3.ebuild @@ -1,15 +1,15 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/hglib/hglib-0.3.ebuild,v 1.1 2013/01/22 13:43:20 idella4 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-python/hglib/hglib-0.3.ebuild,v 1.2 2013/01/23 16:20:50 idella4 Exp $ EAPI=5 -PYTHON_COMPAT="python2_7" +PYTHON_COMPAT=( python2_7 pypy{1_9,2_0} ) PYTHON_USE_WITH="threads" MY_P="python-${P}" MY_PN="python-${PN}" -inherit distutils-r1 +inherit distutils-r1 eutils DESCRIPTION="Library for using the Mercurial Command Server from Python" HOMEPAGE="http://mercurial.selenic.com/" @@ -25,6 +25,11 @@ DEPEND="test? ( dev-python/nose )" S=${WORKDIR}/${MY_P} +src_prepare() { + distutils-r1_src_prepare + epatch "${FILESDIR}"/${P}-tests.patch +} + python_test() { ${PYTHON} test.py } -- cgit v1.2.3-65-gdbad