dev-python/loky: enable py3.10, fix tests

patch from my PR here: https://github.com/joblib/loky/pull/295

Signed-off-by: Arthur Zamarin <arthurzam@gmail.com>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Arthur Zamarin
2021-08-02 18:56:49 +03:00
committed by Michał Górny
parent 9a805920e3
commit 3ecd1f9e7e
2 changed files with 43 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
From 0d31dc24ca9688c11d1fe53fa1283728ecc50706 Mon Sep 17 00:00:00 2001
From: Arthur Zamarin <arthurzam@gmail.com>
Date: Mon, 2 Aug 2021 18:35:31 +0300
Subject: [PATCH] Fix no attribute import_module for python 3.10
In python 3.10, the `import_module` has moved from the
`test.support` module to `test.support.import_helper`.
As fix, try to import the from the new place and if unknown try from
the old place.
---
tests/_test_process_executor.py | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/_test_process_executor.py b/tests/_test_process_executor.py
index 65d9a2c9..3bd0b12d 100644
--- a/tests/_test_process_executor.py
+++ b/tests/_test_process_executor.py
@@ -1,15 +1,18 @@
from __future__ import print_function
try:
- import test.support
+ try:
+ from test.support.import_helper import import_module
+ except ImportError:
+ from test.support import import_module
# Skip tests if _multiprocessing wasn't built.
- test.support.import_module('_multiprocessing')
+ import_module('_multiprocessing')
# Skip tests if sem_open implementation is broken.
- test.support.import_module('multiprocessing.synchronize')
+ import_module('multiprocessing.synchronize')
# import threading after _multiprocessing to raise a more revelant error
# message: "No module named _multiprocessing" if multiprocessing is not
# compiled without thread support.
- test.support.import_module('threading')
+ import_module('threading')
except ImportError:
pass

View File

@@ -3,7 +3,7 @@
EAPI=7
PYTHON_COMPAT=( python3_{7..9} )
PYTHON_COMPAT=( python3_{8..10} )
inherit distutils-r1
DESCRIPTION="Robust and reusable Executor for joblib"
@@ -27,6 +27,7 @@ distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/${P}-libc.patch
"${FILESDIR}"/${P}-fix-py3.10-tests.patch
)
python_test() {