maint more informative assertion errors when warnings happen
This commit is contained in:
parent
bb1a1fb8fe
commit
af5ba369f8
@ -0,0 +1,71 @@
|
|||||||
|
From a9a33285fd713132786d4521be8b881d7c7b07c7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: wang--ge <wang__ge@126.com>
|
||||||
|
Date: Mon, 6 Feb 2023 17:11:39 +0800
|
||||||
|
Subject: [PATCH] maint more informative assertion errors when warings happen
|
||||||
|
|
||||||
|
---
|
||||||
|
continuous_integration/run_tests.sh | 2 +-
|
||||||
|
joblib/test/test_parallel.py | 16 +++++++++++-----
|
||||||
|
2 files changed, 12 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/continuous_integration/run_tests.sh b/continuous_integration/run_tests.sh
|
||||||
|
index 51bed5f..6e7a537 100755
|
||||||
|
--- a/continuous_integration/run_tests.sh
|
||||||
|
+++ b/continuous_integration/run_tests.sh
|
||||||
|
@@ -20,7 +20,7 @@ if [[ "$SKIP_TESTS" != "true" ]]; then
|
||||||
|
export PYTEST_ADDOPTS="--cov=joblib --cov-append"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- pytest joblib -vl --timeout=60 --junitxml="${JUNITXML}"
|
||||||
|
+ pytest joblib -vl --timeout=120 --junitxml="${JUNITXML}"
|
||||||
|
make test-doc
|
||||||
|
fi
|
||||||
|
|
||||||
|
diff --git a/joblib/test/test_parallel.py b/joblib/test/test_parallel.py
|
||||||
|
index 7edeb85..9c6b2dc 100644
|
||||||
|
--- a/joblib/test/test_parallel.py
|
||||||
|
+++ b/joblib/test/test_parallel.py
|
||||||
|
@@ -17,6 +17,7 @@ from time import sleep
|
||||||
|
from pickle import PicklingError
|
||||||
|
from multiprocessing import TimeoutError
|
||||||
|
import pickle
|
||||||
|
+import warnings
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from importlib import reload
|
||||||
|
@@ -190,22 +191,27 @@ def test_main_thread_renamed_no_warning(backend, monkeypatch):
|
||||||
|
|
||||||
|
|
||||||
|
def _assert_warning_nested(backend, inner_n_jobs, expected):
|
||||||
|
- with warns(None) as records:
|
||||||
|
+ with warnings.catch_warnings(record=True) as records:
|
||||||
|
+ warnings.simplefilter("always")
|
||||||
|
parallel_func(backend=backend, inner_n_jobs=inner_n_jobs)
|
||||||
|
|
||||||
|
+ messages = [w.message for w in records]
|
||||||
|
if expected:
|
||||||
|
# with threading, we might see more that one records
|
||||||
|
- if len(records) > 0:
|
||||||
|
- return 'backed parallel loops cannot' in records[0].message.args[0]
|
||||||
|
+ if warnings:
|
||||||
|
+ return (len(messages)==1 and 'backed parallel loops cannot' in messages[0].args[0])
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
- assert len(records) == 0
|
||||||
|
+ assert not messages
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@with_multiprocessing
|
||||||
|
@parametrize('parent_backend,child_backend,expected', [
|
||||||
|
- ('loky', 'multiprocessing', True), ('loky', 'loky', False),
|
||||||
|
+ ('loky', 'multiprocessing', True),
|
||||||
|
+ # XXX: loky nested under loky causes pytest 7+ to freeze after tests end when using warnings.catch_warnings:
|
||||||
|
+ # deadlock happens in loky/process_executor.py", line 193, in _python_exit
|
||||||
|
+ # ('loky', 'loky', False),
|
||||||
|
('multiprocessing', 'multiprocessing', True),
|
||||||
|
('multiprocessing', 'loky', True),
|
||||||
|
('threading', 'multiprocessing', True),
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
Name: python-%{pypi_name}
|
Name: python-%{pypi_name}
|
||||||
Version: 1.1.0
|
Version: 1.1.0
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Utilities to provide lightweight pipelining in Python
|
Summary: Utilities to provide lightweight pipelining in Python
|
||||||
License: BSD-licenced (3 clause)
|
License: BSD-3-clause
|
||||||
URL: https://joblib.readthedocs.io/en/latest/
|
URL: https://joblib.readthedocs.io/en/latest/
|
||||||
Source0: https://github.com/joblib/joblib/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz
|
Source0: https://github.com/joblib/joblib/archive/%{version}.tar.gz#/%{pypi_name}-%{version}.tar.gz
|
||||||
|
Patch1: maint-more-informative-assertion-errors-when-warnings-happen.patch
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
BuildRequires: python3-devel
|
BuildRequires: python3-devel
|
||||||
#test requires
|
#test requires
|
||||||
@ -25,7 +26,7 @@ Summary: %{summary}
|
|||||||
%description -n python3-%{pypi_name} %{_description}
|
%description -n python3-%{pypi_name} %{_description}
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{pypi_name}-%{version}
|
%autosetup -n %{pypi_name}-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%py3_build
|
%py3_build
|
||||||
@ -44,6 +45,9 @@ Summary: %{summary}
|
|||||||
%{python3_sitelib}/%{pypi_name}/
|
%{python3_sitelib}/%{pypi_name}/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 06 2023 Ge Wang <wangge20@h-partners.com> - 1.1.0-2
|
||||||
|
- Maint more informative assertion errors when warnings happen
|
||||||
|
|
||||||
* Thu Jun 09 2022 SimpleUpdate Robot <tc@openeuler.org> - 1.1.0-1
|
* Thu Jun 09 2022 SimpleUpdate Robot <tc@openeuler.org> - 1.1.0-1
|
||||||
- Upgrade to version 1.1.0
|
- Upgrade to version 1.1.0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user