commit:     49a2baca146ef87e74904a66f0f9f715822bc783
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 24 18:59:54 2020 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sun Oct 25 00:27:40 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49a2baca

dev-python/random2: python3_9, enable tests in the first place, pass

Package-Manager: Portage-3.0.8, Repoman-3.0.2
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../random2/files/random2-1.0.1-py39-tests.patch   | 32 ++++++++++++++++++++++
 dev-python/random2/random2-1.0.1-r1.ebuild         |  7 ++++-
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/dev-python/random2/files/random2-1.0.1-py39-tests.patch 
b/dev-python/random2/files/random2-1.0.1-py39-tests.patch
new file mode 100644
index 00000000000..48317af2f25
--- /dev/null
+++ b/dev-python/random2/files/random2-1.0.1-py39-tests.patch
@@ -0,0 +1,32 @@
+From a60d5ce10e5df0cebd7e7de0bff6f291bf9403ca Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <ast...@gentoo.org>
+Date: Sat, 24 Oct 2020 20:57:00 +0200
+Subject: [PATCH] getrandbits() accepts 0 in python3_9
+
+---
+ src/tests.py | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/tests.py b/src/tests.py
+index d918891..6f600ab 100644
+--- a/src/tests.py
++++ b/src/tests.py
+@@ -291,7 +291,6 @@ class SystemRandom_TestBasicOps(TestBasicOps):
+         # Verify argument checking
+         self.assertRaises(TypeError, self.gen.getrandbits)
+         self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
+-        self.assertRaises(ValueError, self.gen.getrandbits, 0)
+         self.assertRaises(ValueError, self.gen.getrandbits, -1)
+         self.assertRaises(TypeError, self.gen.getrandbits, 10.1)
+ 
+@@ -448,7 +447,6 @@ class MersenneTwister_TestBasicOps(TestBasicOps):
+         self.assertRaises(TypeError, self.gen.getrandbits)
+         self.assertRaises(TypeError, self.gen.getrandbits, 'a')
+         self.assertRaises(TypeError, self.gen.getrandbits, 1, 2)
+-        self.assertRaises(ValueError, self.gen.getrandbits, 0)
+         self.assertRaises(ValueError, self.gen.getrandbits, -1)
+ 
+     def test_randbelow_logic(self, _log=log, int=int):
+-- 
+2.29.1
+

diff --git a/dev-python/random2/random2-1.0.1-r1.ebuild 
b/dev-python/random2/random2-1.0.1-r1.ebuild
index 0599ef488cd..6eb84a53956 100644
--- a/dev-python/random2/random2-1.0.1-r1.ebuild
+++ b/dev-python/random2/random2-1.0.1-r1.ebuild
@@ -3,15 +3,20 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_COMPAT=( python3_{6,7,8,9} )
 inherit distutils-r1
 
 DESCRIPTION="Python-2.7 random module ported to python-3"
 HOMEPAGE="https://pypi.org/project/random2/";
 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.zip"
+
 LICENSE="PSF-2"
 SLOT="0"
 KEYWORDS="amd64 arm64 x86"
 
 BDEPEND="app-arch/unzip
        dev-python/setuptools[${PYTHON_USEDEP}]"
+
+distutils_enable_tests setup.py
+
+PATCHES=( "${FILESDIR}/${P}-py39-tests.patch" )

Reply via email to