Accepting request 873000 from home:badshah400:branches:devel:languages:python:numeric
* Update to version 4.13.0. * Add sherpa-numpy-1.20.patch: Fix test errors with numpy 1.20 [gh#sherpa/sherpa#/1092]; patch committed upstream. * Disable python 3.6 flavour: dependency numpy not supported. OBS-URL: https://build.opensuse.org/request/show/873000 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-sherpa?expand=0&rev=13
This commit is contained in:
parent
2e12bdc119
commit
14bc0b2cc6
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 17 00:07:40 UTC 2021 - Atri Bhattacharya <badshah400@gmail.com>
|
||||
|
||||
- Update to version 4.13.0:
|
||||
* A few minor documentation updates.
|
||||
* Version number update to coincide with CIAO version 4.13.0.
|
||||
- Add sherpa-numpy-1.20.patch: Fix test errors with numpy 1.20
|
||||
[gh#sherpa/sherpa#/1092]; patch committed upstream.
|
||||
- Disable python 3.6 flavour: dependency numpy not supported.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 14 13:39:10 UTC 2020 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-sherpa
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LLC
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -18,8 +18,9 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python2 1
|
||||
%define skip_python36 1
|
||||
Name: python-sherpa
|
||||
Version: 4.12.1
|
||||
Version: 4.13.0
|
||||
Release: 0
|
||||
Summary: Modeling and fitting package for scientific data analysis
|
||||
License: GPL-3.0-only
|
||||
@ -28,6 +29,8 @@ Source: https://github.com/sherpa/sherpa/archive/%{version}.tar.gz#/sher
|
||||
Patch1: reproducible.patch
|
||||
# PATCH-FIX-UPSTREAM - https://github.com/sherpa/sherpa/issues/970
|
||||
Patch2: sherpa-fix-aarch64.patch
|
||||
# PATCH-FIX-UPSTREAM sherpa-numpy-1.20.patch badshah400@gmail.com - Fix test errors with numpy 1.20 [https://github.com/sherpa/sherpa/pull/1092]
|
||||
Patch3: sherpa-numpy-1.20.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module numpy-devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:52af00976de7fe9a1a5b64effa9baae8d850f06a7e046025b48d05d4f54f9af9
|
||||
size 11607411
|
3
sherpa-4.13.0.tar.gz
Normal file
3
sherpa-4.13.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:91b64be0ebc3429e68292d8025bb5dd25916ce645bef6159151678611319c99a
|
||||
size 12430999
|
200
sherpa-numpy-1.20.patch
Normal file
200
sherpa-numpy-1.20.patch
Normal file
@ -0,0 +1,200 @@
|
||||
From 1ca81268c560b712677f91c98c5481ef473bfa0e Mon Sep 17 00:00:00 2001
|
||||
From: Douglas Burke <dburke.gw@gmail.com>
|
||||
Date: Sun, 31 Jan 2021 19:03:24 -0500
|
||||
Subject: [PATCH 1/3] Whitelist np.bool/int/float warning from NumPy 1.20 in
|
||||
tests
|
||||
|
||||
As well as white-listing the warnings I've had to tweak one set
|
||||
of tests which was explicitly checking the warning messages
|
||||
(and so needed to ignore the known warnings).
|
||||
---
|
||||
.../astro/tests/test_astro_data_swift_unit.py | 21 ++++++----
|
||||
sherpa/conftest.py | 38 +++++++++++++++----
|
||||
2 files changed, 43 insertions(+), 16 deletions(-)
|
||||
|
||||
Index: sherpa-4.13.0/sherpa/astro/tests/test_astro_data_swift_unit.py
|
||||
===================================================================
|
||||
--- sherpa-4.13.0.orig/sherpa/astro/tests/test_astro_data_swift_unit.py
|
||||
+++ sherpa-4.13.0/sherpa/astro/tests/test_astro_data_swift_unit.py
|
||||
@@ -172,7 +172,12 @@ def test_read_pha_fails_rmf(make_data_pa
|
||||
assert emsg in str(excinfo.value)
|
||||
|
||||
|
||||
-def validate_replacement_warning(ws, rtype, label):
|
||||
+def validate_replacement_warning(ws, rtype, label, is_known_warning):
|
||||
+ """Check that there is one expected warning."""
|
||||
+
|
||||
+ # Filter out the "allowed" warnings.
|
||||
+ #
|
||||
+ ws = [w for w in ws if not is_known_warning(w)]
|
||||
|
||||
assert len(ws) == 1
|
||||
w = ws[0]
|
||||
@@ -185,7 +190,7 @@ def validate_replacement_warning(ws, rty
|
||||
|
||||
@requires_data
|
||||
@requires_fits
|
||||
-def test_read_arf(make_data_path):
|
||||
+def test_read_arf(make_data_path, is_known_warning):
|
||||
"""Can we read in a Swift ARF."""
|
||||
|
||||
infile = make_data_path(ARFFILE)
|
||||
@@ -194,7 +199,7 @@ def test_read_arf(make_data_path):
|
||||
warnings.simplefilter("always")
|
||||
arf = io.read_arf(infile)
|
||||
|
||||
- validate_replacement_warning(ws, 'ARF', infile)
|
||||
+ validate_replacement_warning(ws, 'ARF', infile, is_known_warning)
|
||||
|
||||
assert isinstance(arf, DataARF)
|
||||
|
||||
@@ -262,7 +267,7 @@ def test_read_arf_fails_rmf(make_data_pa
|
||||
|
||||
@requires_data
|
||||
@requires_fits
|
||||
-def test_read_rmf(make_data_path):
|
||||
+def test_read_rmf(make_data_path, is_known_warning):
|
||||
"""Can we read in a Swift RMF."""
|
||||
|
||||
infile = make_data_path(RMFFILE)
|
||||
@@ -271,7 +276,7 @@ def test_read_rmf(make_data_path):
|
||||
warnings.simplefilter("always")
|
||||
rmf = io.read_rmf(infile)
|
||||
|
||||
- validate_replacement_warning(ws, 'RMF', infile)
|
||||
+ validate_replacement_warning(ws, 'RMF', infile, is_known_warning)
|
||||
|
||||
assert isinstance(rmf, DataRMF)
|
||||
|
||||
@@ -362,7 +367,7 @@ def test_read_rmf_fails_arf(make_data_pa
|
||||
|
||||
@requires_data
|
||||
@requires_fits
|
||||
-def test_can_use_swift_data(make_data_path):
|
||||
+def test_can_use_swift_data(make_data_path, is_known_warning):
|
||||
"""A basic check that we can read in and use the Swift data.
|
||||
|
||||
Unlike the previous tests, that directly access the io module,
|
||||
@@ -383,14 +388,14 @@ def test_can_use_swift_data(make_data_pa
|
||||
warnings.simplefilter("always")
|
||||
ui.load_rmf(rmffile)
|
||||
|
||||
- validate_replacement_warning(ws, 'RMF', rmffile)
|
||||
+ validate_replacement_warning(ws, 'RMF', rmffile, is_known_warning)
|
||||
|
||||
arffile = make_data_path(ARFFILE)
|
||||
with warnings.catch_warnings(record=True) as ws:
|
||||
warnings.simplefilter("always")
|
||||
ui.load_arf(arffile)
|
||||
|
||||
- validate_replacement_warning(ws, 'ARF', arffile)
|
||||
+ validate_replacement_warning(ws, 'ARF', arffile, is_known_warning)
|
||||
|
||||
assert ui.get_analysis() == 'energy'
|
||||
|
||||
Index: sherpa-4.13.0/sherpa/conftest.py
|
||||
===================================================================
|
||||
--- sherpa-4.13.0.orig/sherpa/conftest.py
|
||||
+++ sherpa-4.13.0/sherpa/conftest.py
|
||||
@@ -116,7 +116,12 @@ known_warnings = {
|
||||
# Matplotlib version 2 warnings (from HTML notebook represention)
|
||||
#
|
||||
r'np.asscalar\(a\) is deprecated since NumPy v1.16, use a.item\(\) instead',
|
||||
- r"Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working"
|
||||
+ r"Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working",
|
||||
+
|
||||
+ # numpy 1.20 bool/float issue
|
||||
+ r'`np.bool` is a deprecated alias for the builtin `bool`. .*',
|
||||
+ r'`np.int` is a deprecated alias for the builtin `int`. .*',
|
||||
+ r'`np.float` is a deprecated alias for the builtin `float`. .*',
|
||||
],
|
||||
UserWarning:
|
||||
[
|
||||
@@ -140,18 +145,11 @@ known_warnings = {
|
||||
# See https://github.com/ContinuumIO/anaconda-issues/issues/6678
|
||||
r"numpy.dtype size changed, may indicate binary " +
|
||||
r"incompatibility. Expected 96, got 88",
|
||||
- # I am getting the following from astropy with at least python 2.7 during the conda tests
|
||||
- r"numpy.ufunc size changed, may indicate binary ",
|
||||
+ # See https://github.com/numpy/numpy/pull/432
|
||||
+ r"numpy.ufunc size changed",
|
||||
+ # numpy 1.20 shows this in some tests
|
||||
+ r"numpy.ndarray size changed, may indicate binary "
|
||||
],
|
||||
- VisibleDeprecationWarning:
|
||||
- [],
|
||||
-}
|
||||
-
|
||||
-# Since Sherpa now requires Python 3.5 at a minumum, the following
|
||||
-# are always added, but kept as a separate dict and then merged
|
||||
-# to make it clearer where they came from.
|
||||
-#
|
||||
-python3_warnings = {
|
||||
ResourceWarning:
|
||||
[
|
||||
r"unclosed file .*king_kernel.txt.* closefd=True>",
|
||||
@@ -166,17 +164,9 @@ python3_warnings = {
|
||||
r"unclosed file .*/dev/null.* closefd=True>",
|
||||
r"unclosed file .*table.txt.* closefd=True>",
|
||||
],
|
||||
- RuntimeWarning:
|
||||
- [r"invalid value encountered in sqrt",
|
||||
- # See https://github.com/ContinuumIO/anaconda-issues/issues/6678
|
||||
- r"numpy.dtype size changed, may indicate binary " +
|
||||
- r"incompatibility. Expected 96, got 88",
|
||||
- # See https://github.com/numpy/numpy/pull/432
|
||||
- r"numpy.ufunc size changed"
|
||||
- ],
|
||||
+ VisibleDeprecationWarning:
|
||||
+ [],
|
||||
}
|
||||
-known_warnings.update(python3_warnings)
|
||||
-
|
||||
|
||||
if have_astropy:
|
||||
astropy_warnings = {
|
||||
@@ -230,13 +220,8 @@ def capture_all_warnings(request, recwar
|
||||
pytestconfig injected service for accessing the configuration data
|
||||
|
||||
"""
|
||||
- def known(warning):
|
||||
- message = warning.message
|
||||
- for known_warning in known_warnings[type(message)]:
|
||||
- pattern = re.compile(known_warning)
|
||||
- if pattern.match(str(message)):
|
||||
- return True
|
||||
- return False
|
||||
+
|
||||
+ known = check_known_warning
|
||||
|
||||
def fin():
|
||||
warnings = [w for w in recwarn.list
|
||||
@@ -263,6 +248,28 @@ def capture_all_warnings(request, recwar
|
||||
request.addfinalizer(fin)
|
||||
|
||||
|
||||
+def check_known_warning(warning):
|
||||
+ """Return True if this is an "allowed" warning."""
|
||||
+
|
||||
+ message = warning.message
|
||||
+ for known_warning in known_warnings[type(message)]:
|
||||
+ pattern = re.compile(known_warning)
|
||||
+ if pattern.match(str(message)):
|
||||
+ return True
|
||||
+
|
||||
+ return False
|
||||
+
|
||||
+
|
||||
+@pytest.fixture
|
||||
+def is_known_warning():
|
||||
+ """Returns a function that returns True if this is an "allowed" warning.
|
||||
+
|
||||
+ It is not expected that this will see much use.
|
||||
+ """
|
||||
+
|
||||
+ return check_known_warning
|
||||
+
|
||||
+
|
||||
def pytest_configure(config):
|
||||
"""
|
||||
This configuration hook overrides the default mechanism for test data self-discovery, if the --test-data command line
|
Loading…
x
Reference in New Issue
Block a user