Accepting request 822314 from devel:languages:python:numeric
OBS-URL: https://build.opensuse.org/request/show/822314 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pandas?expand=0&rev=28
This commit is contained in:
commit
0ae16f8f66
3
_multibuild
Normal file
3
_multibuild
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<multibuild>
|
||||||
|
<package>test</package>
|
||||||
|
</multibuild>
|
@ -1,12 +0,0 @@
|
|||||||
diff --git a/pandas/tests/reshape/merge/test_merge.py b/pandas/tests/reshape/merge/test_merge.py
|
|
||||||
index 8465e2c..f53d2ad 100644
|
|
||||||
--- a/pandas/tests/reshape/merge/test_merge.py
|
|
||||||
+++ b/pandas/tests/reshape/merge/test_merge.py
|
|
||||||
@@ -1459,6 +1459,7 @@ class TestMergeDtypes:
|
|
||||||
)
|
|
||||||
tm.assert_frame_equal(result, expected)
|
|
||||||
|
|
||||||
+ @pytest.mark.xfail
|
|
||||||
def test_merge_on_ints_floats_warning(self):
|
|
||||||
# GH 16572
|
|
||||||
# merge will produce a warning when merging on int and
|
|
78
pandas-pr34991-npconstructor.patch
Normal file
78
pandas-pr34991-npconstructor.patch
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
Index: pandas-1.0.5/pandas/core/internals/construction.py
|
||||||
|
===================================================================
|
||||||
|
--- pandas-1.0.5.orig/pandas/core/internals/construction.py
|
||||||
|
+++ pandas-1.0.5/pandas/core/internals/construction.py
|
||||||
|
@@ -292,7 +292,7 @@ def prep_ndarray(values, copy=True) -> n
|
||||||
|
if values.ndim == 1:
|
||||||
|
values = values.reshape((values.shape[0], 1))
|
||||||
|
elif values.ndim != 2:
|
||||||
|
- raise ValueError("Must pass 2-d input")
|
||||||
|
+ raise ValueError(f"Must pass 2-d input. shape={values.shape}")
|
||||||
|
|
||||||
|
return values
|
||||||
|
|
||||||
|
Index: pandas-1.0.5/pandas/tests/frame/test_constructors.py
|
||||||
|
===================================================================
|
||||||
|
--- pandas-1.0.5.orig/pandas/tests/frame/test_constructors.py
|
||||||
|
+++ pandas-1.0.5/pandas/tests/frame/test_constructors.py
|
||||||
|
@@ -9,7 +9,7 @@ import numpy.ma.mrecords as mrecords
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from pandas.compat import is_platform_little_endian
|
||||||
|
-from pandas.compat.numpy import _is_numpy_dev
|
||||||
|
+from pandas.compat.numpy import _np_version_under1p19
|
||||||
|
|
||||||
|
from pandas.core.dtypes.common import is_integer_dtype
|
||||||
|
|
||||||
|
@@ -145,14 +145,20 @@ class TestDataFrameConstructors:
|
||||||
|
assert df.loc[1, 0] is None
|
||||||
|
assert df.loc[0, 1] == "2"
|
||||||
|
|
||||||
|
- @pytest.mark.xfail(_is_numpy_dev, reason="Interprets list of frame as 3D")
|
||||||
|
- def test_constructor_list_frames(self):
|
||||||
|
- # see gh-3243
|
||||||
|
- result = DataFrame([DataFrame()])
|
||||||
|
- assert result.shape == (1, 0)
|
||||||
|
-
|
||||||
|
- result = DataFrame([DataFrame(dict(A=np.arange(5)))])
|
||||||
|
- assert isinstance(result.iloc[0, 0], DataFrame)
|
||||||
|
+ @pytest.mark.skipif(_np_version_under1p19, reason="NumPy change.")
|
||||||
|
+ def test_constructor_list_of_2d_raises(self):
|
||||||
|
+ # https://github.com/pandas-dev/pandas/issues/32289
|
||||||
|
+ a = pd.DataFrame()
|
||||||
|
+ b = np.empty((0, 0))
|
||||||
|
+ with pytest.raises(ValueError, match=r"shape=\(1, 0, 0\)"):
|
||||||
|
+ pd.DataFrame([a])
|
||||||
|
+
|
||||||
|
+ with pytest.raises(ValueError, match=r"shape=\(1, 0, 0\)"):
|
||||||
|
+ pd.DataFrame([b])
|
||||||
|
+
|
||||||
|
+ a = pd.DataFrame({"A": [1, 2]})
|
||||||
|
+ with pytest.raises(ValueError, match=r"shape=\(2, 2, 1\)"):
|
||||||
|
+ pd.DataFrame([a, a])
|
||||||
|
|
||||||
|
def test_constructor_mixed_dtypes(self):
|
||||||
|
def _make_mixed_dtypes_df(typ, ad=None):
|
||||||
|
@@ -498,22 +504,6 @@ class TestDataFrameConstructors:
|
||||||
|
with pytest.raises(ValueError, match=msg):
|
||||||
|
DataFrame({"a": False, "b": True})
|
||||||
|
|
||||||
|
- @pytest.mark.xfail(_is_numpy_dev, reason="Interprets embedded frame as 3D")
|
||||||
|
- def test_constructor_with_embedded_frames(self):
|
||||||
|
-
|
||||||
|
- # embedded data frames
|
||||||
|
- df1 = DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
|
||||||
|
- df2 = DataFrame([df1, df1 + 10])
|
||||||
|
-
|
||||||
|
- df2.dtypes
|
||||||
|
- str(df2)
|
||||||
|
-
|
||||||
|
- result = df2.loc[0, 0]
|
||||||
|
- tm.assert_frame_equal(result, df1)
|
||||||
|
-
|
||||||
|
- result = df2.loc[1, 0]
|
||||||
|
- tm.assert_frame_equal(result, df1 + 10)
|
||||||
|
-
|
||||||
|
def test_constructor_subclass_dict(self, float_frame, dict_subclass):
|
||||||
|
# Test for passing dict subclass to constructor
|
||||||
|
data = {
|
13
pandas-pytest.ini
Normal file
13
pandas-pytest.ini
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[pytest]
|
||||||
|
minversion = 4.0.2
|
||||||
|
markers =
|
||||||
|
single: mark a test as single cpu only
|
||||||
|
slow: mark a test as slow
|
||||||
|
network: mark a test as network
|
||||||
|
db: tests requiring a database (mysql or postgres)
|
||||||
|
high_memory: mark a test as a high-memory only
|
||||||
|
clipboard: mark a pd.read_clipboard test
|
||||||
|
filterwarnings =
|
||||||
|
error:Sparse:FutureWarning
|
||||||
|
error:The SparseArray:FutureWarning
|
||||||
|
junit_family = xunit2
|
@ -1,3 +1,16 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 22 10:04:49 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- support newest numpy by removing old test
|
||||||
|
gh#pandas-dev/pandas#34991 pandas-pr34991-npconstructor.patch
|
||||||
|
- move testing to multibuild flavor
|
||||||
|
- run slow tests only on x86_64
|
||||||
|
- replace gcc10-skip-one-test.patch with pytest -k deselection
|
||||||
|
- tidy SKIP_TESTS declarations
|
||||||
|
- add pandas-pytest.ini as pytest.ini in order to support the
|
||||||
|
custom marks and filter some warnings
|
||||||
|
- remove random hash seed
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jun 30 13:03:14 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
Tue Jun 30 13:03:14 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
@ -18,7 +18,15 @@
|
|||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%define skip_python2 1
|
%define skip_python2 1
|
||||||
Name: python-pandas
|
%global flavor @BUILD_FLAVOR@%{nil}
|
||||||
|
%if "%{flavor}" == "test"
|
||||||
|
%define psuffix -test
|
||||||
|
%bcond_without test
|
||||||
|
%else
|
||||||
|
%define psuffix %{nil}
|
||||||
|
%bcond_with test
|
||||||
|
%endif
|
||||||
|
Name: python-pandas%{psuffix}
|
||||||
Version: 1.0.5
|
Version: 1.0.5
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Python data structures for data analysis, time series, and statistics
|
Summary: Python data structures for data analysis, time series, and statistics
|
||||||
@ -26,7 +34,9 @@ License: BSD-3-Clause
|
|||||||
Group: Development/Libraries/Python
|
Group: Development/Libraries/Python
|
||||||
URL: https://pandas.pydata.org/
|
URL: https://pandas.pydata.org/
|
||||||
Source0: https://files.pythonhosted.org/packages/source/p/pandas/pandas-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/p/pandas/pandas-%{version}.tar.gz
|
||||||
Patch0: gcc10-skip-one-test.patch
|
Source99: pandas-pytest.ini
|
||||||
|
# PATCH-FIX-UPSTREAM gh#pandas-dev/pandas#34991
|
||||||
|
Patch0: pandas-pr34991-npconstructor.patch
|
||||||
BuildRequires: %{python_module Cython >= 0.28.2}
|
BuildRequires: %{python_module Cython >= 0.28.2}
|
||||||
# test requirements
|
# test requirements
|
||||||
BuildRequires: %{python_module Jinja2}
|
BuildRequires: %{python_module Jinja2}
|
||||||
@ -73,13 +83,14 @@ Recommends: xclip
|
|||||||
Recommends: xsel
|
Recommends: xsel
|
||||||
Obsoletes: python-pandas-doc < %{version}
|
Obsoletes: python-pandas-doc < %{version}
|
||||||
Provides: python-pandas-doc = %{version}
|
Provides: python-pandas-doc = %{version}
|
||||||
# SECTION test requirements
|
%if %{with test}
|
||||||
BuildRequires: %{python_module SQLAlchemy >= 1.1.4}
|
BuildRequires: %{python_module SQLAlchemy >= 1.1.4}
|
||||||
BuildRequires: %{python_module XlsxWriter >= 0.9.8}
|
BuildRequires: %{python_module XlsxWriter >= 0.9.8}
|
||||||
BuildRequires: %{python_module beautifulsoup4 >= 4.6.0}
|
BuildRequires: %{python_module beautifulsoup4 >= 4.6.0}
|
||||||
BuildRequires: %{python_module hypothesis}
|
BuildRequires: %{python_module hypothesis}
|
||||||
BuildRequires: %{python_module lxml >= 3.8.0}
|
BuildRequires: %{python_module lxml >= 3.8.0}
|
||||||
BuildRequires: %{python_module openpyxl >= 2.4.8}
|
BuildRequires: %{python_module openpyxl >= 2.4.8}
|
||||||
|
BuildRequires: %{python_module pandas = %{version}}
|
||||||
BuildRequires: %{python_module pytest >= 4.0.2}
|
BuildRequires: %{python_module pytest >= 4.0.2}
|
||||||
BuildRequires: %{python_module pytest-mock}
|
BuildRequires: %{python_module pytest-mock}
|
||||||
BuildRequires: %{python_module pytest-xdist}
|
BuildRequires: %{python_module pytest-xdist}
|
||||||
@ -88,7 +99,7 @@ BuildRequires: %{python_module pytz >= 2015.4}
|
|||||||
BuildRequires: %{python_module xlrd >= 1.1.0}
|
BuildRequires: %{python_module xlrd >= 1.1.0}
|
||||||
BuildRequires: %{python_module xlwt >= 1.2.0}
|
BuildRequires: %{python_module xlwt >= 1.2.0}
|
||||||
BuildRequires: xvfb-run
|
BuildRequires: xvfb-run
|
||||||
# /SECTION
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -98,47 +109,73 @@ heterogeneous) and time series data. It is a high-level building
|
|||||||
block for doing data analysis in Python.
|
block for doing data analysis in Python.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
|
%if !%{with test}
|
||||||
%setup -q -n pandas-%{version}
|
%setup -q -n pandas-%{version}
|
||||||
sed -i -e 's/\r//g' pandas/tests/reshape/merge/test_merge.py
|
sed -i -e 's/\r//g' pandas/tests/reshape/merge/test_merge.py
|
||||||
%patch0 -p1
|
%patch0 -p1
|
||||||
sed -i -e '/^#!\//, 1d' pandas/core/computation/eval.py
|
sed -i -e '/^#!\//, 1d' pandas/core/computation/eval.py
|
||||||
sed -i -e '/^#!\//, 1d' pandas/tests/io/generate_legacy_storage_files.py
|
sed -i -e '/^#!\//, 1d' pandas/tests/io/generate_legacy_storage_files.py
|
||||||
sed -i -e '/^#!\//, 1d' pandas/tests/plotting/common.py
|
sed -i -e '/^#!\//, 1d' pandas/tests/plotting/common.py
|
||||||
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
%if !%{with test}
|
||||||
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
export CFLAGS="%{optflags} -fno-strict-aliasing"
|
||||||
%python_build
|
%python_build
|
||||||
|
%endif
|
||||||
|
|
||||||
%install
|
%install
|
||||||
|
%if !%{with test}
|
||||||
%python_install
|
%python_install
|
||||||
%python_expand sed -i -e 's|"python", "-c",|"%{__$python}", "-c",|' %{buildroot}%{$python_sitearch}/pandas/tests/io/test_compression.py
|
%{python_expand sed -i -e 's|"python", "-c",|"%{__$python}", "-c",|' %{buildroot}%{$python_sitearch}/pandas/tests/io/test_compression.py
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
%fdupes %{buildroot}%{$python_sitearch}
|
||||||
|
# can be removed for pandas >= 1.1 https://github.com/pandas-dev/pandas/pull/35146
|
||||||
|
install %SOURCE99 %{buildroot}%{$python_sitearch}/pandas/pytest.ini
|
||||||
|
}
|
||||||
|
%endif
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# skip test that tries to compile stuff in buildroot test_oo_optimizable
|
%if %{with test}
|
||||||
# test_encode_non_c_locale - skip test as it overflows on 32bit
|
|
||||||
# test_maybe_promote_int_with_int https://github.com/pandas-dev/pandas/issues/31856
|
|
||||||
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
|
|
||||||
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
|
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export LC_ALL=en_US.UTF-8
|
export LC_ALL=en_US.UTF-8
|
||||||
export PYTHONDONTWRITEBYTECODE=1
|
export PYTHONDONTWRITEBYTECODE=1
|
||||||
export SKIP_TESTS="test_oo_optimizable or test_encode_non_c_locale or test_maybe_promote_int_with_int"
|
# Workaround for pytest-xdist flaky collection order
|
||||||
# Skip test_raw_roundtrip on i586, gh#pandas-dev/pandas#29712
|
# https://github.com/pytest-dev/pytest/issues/920
|
||||||
|
# https://github.com/pytest-dev/pytest/issues/1075
|
||||||
|
export PYTHONHASHSEED=1
|
||||||
|
# tries to compile stuff in buildroot test_oo_optimizable
|
||||||
|
SKIP_TESTS+=" or test_oo_optimizable"
|
||||||
%ifarch %{ix86}
|
%ifarch %{ix86}
|
||||||
SKIP_TESTS="$SKIP_TESTS or test_raw_roundtrip"
|
# https://github.com/pandas-dev/pandas/issues/29712
|
||||||
|
SKIP_TESTS+=" or test_raw_roundtrip"
|
||||||
|
# overflows on i586
|
||||||
|
SKIP_TESTS+=" or test_encode_non_c_locale"
|
||||||
|
# fails on i586 (was gcc10-skip-one-test.patch)
|
||||||
|
SKIP_TESTS+=" or test_merge_on_ints_floats_warning"
|
||||||
%endif
|
%endif
|
||||||
mv pandas pandas_temp
|
# https://github.com/pandas-dev/pandas/issues/31856
|
||||||
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
|
[ $(getconf LONG_BIT) = "32" ] && SKIP_TESTS+=" or test_maybe_promote_int_with_int"
|
||||||
$python -c 'import pandas; print(pandas.show_versions())'
|
%ifnarch x86_64
|
||||||
xvfb-run py.test-%{$python_version} -n auto -v %{buildroot}%{$python_sitearch}/pandas/tests -k "not ($SKIP_TESTS)"
|
# run the slow tests only on x86_64
|
||||||
|
%define test_fast --skip-slow --skip-db
|
||||||
|
%endif
|
||||||
|
%{python_expand $python -c 'import pandas; print(pandas.__path__); print(pandas.show_versions())'
|
||||||
|
# need to specify test path directly instead of --pyargs pandas in order
|
||||||
|
# to find pytest.ini and all conftest.py files
|
||||||
|
xvfb-run pytest-%{$python_bin_suffix} -v -n auto %{?test_fast} \
|
||||||
|
-p no:cacheprovider \
|
||||||
|
-k "not (${SKIP_TESTS:4})" \
|
||||||
|
%{$python_sitearch}/pandas
|
||||||
}
|
}
|
||||||
mv pandas_temp pandas
|
%endif
|
||||||
|
|
||||||
|
%if !%{with test}
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%doc doc/README.rst RELEASE.md
|
%doc doc/README.rst RELEASE.md
|
||||||
%{python_sitearch}/pandas/
|
%{python_sitearch}/pandas/
|
||||||
%{python_sitearch}/pandas-%{version}-py*.egg-info
|
%{python_sitearch}/pandas-%{version}-py*.egg-info
|
||||||
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user