1
0
forked from pool/python-pandas

Accepting request 822301 from home:bnavigator:branches:devel:languages:python:numeric

- 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

OBS-URL: https://build.opensuse.org/request/show/822301
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pandas?expand=0&rev=46
This commit is contained in:
Tomáš Chvátal
2020-07-23 06:35:55 +00:00
committed by Git OBS Bridge
parent ca2342b165
commit 91a92cf40c
6 changed files with 162 additions and 30 deletions

View File

@@ -18,7 +18,15 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%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
Release: 0
Summary: Python data structures for data analysis, time series, and statistics
@@ -26,7 +34,9 @@ License: BSD-3-Clause
Group: Development/Libraries/Python
URL: https://pandas.pydata.org/
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}
# test requirements
BuildRequires: %{python_module Jinja2}
@@ -73,13 +83,14 @@ Recommends: xclip
Recommends: xsel
Obsoletes: 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 XlsxWriter >= 0.9.8}
BuildRequires: %{python_module beautifulsoup4 >= 4.6.0}
BuildRequires: %{python_module hypothesis}
BuildRequires: %{python_module lxml >= 3.8.0}
BuildRequires: %{python_module openpyxl >= 2.4.8}
BuildRequires: %{python_module pandas = %{version}}
BuildRequires: %{python_module pytest >= 4.0.2}
BuildRequires: %{python_module pytest-mock}
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 xlwt >= 1.2.0}
BuildRequires: xvfb-run
# /SECTION
%endif
%python_subpackages
%description
@@ -98,47 +109,73 @@ heterogeneous) and time series data. It is a high-level building
block for doing data analysis in Python.
%prep
%if !%{with test}
%setup -q -n pandas-%{version}
sed -i -e 's/\r//g' pandas/tests/reshape/merge/test_merge.py
%patch0 -p1
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/plotting/common.py
%endif
%build
%if !%{with test}
export CFLAGS="%{optflags} -fno-strict-aliasing"
%python_build
%endif
%install
%if !%{with test}
%python_install
%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}
%{python_expand sed -i -e 's|"python", "-c",|"%{__$python}", "-c",|' %{buildroot}%{$python_sitearch}/pandas/tests/io/test_compression.py
%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
# skip test that tries to compile stuff in buildroot test_oo_optimizable
# 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))')
%if %{with test}
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export PYTHONDONTWRITEBYTECODE=1
export SKIP_TESTS="test_oo_optimizable or test_encode_non_c_locale or test_maybe_promote_int_with_int"
# Skip test_raw_roundtrip on i586, gh#pandas-dev/pandas#29712
# Workaround for pytest-xdist flaky collection order
# 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}
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
mv pandas pandas_temp
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
$python -c 'import pandas; print(pandas.show_versions())'
xvfb-run py.test-%{$python_version} -n auto -v %{buildroot}%{$python_sitearch}/pandas/tests -k "not ($SKIP_TESTS)"
# https://github.com/pandas-dev/pandas/issues/31856
[ $(getconf LONG_BIT) = "32" ] && SKIP_TESTS+=" or test_maybe_promote_int_with_int"
%ifnarch x86_64
# 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}
%license LICENSE
%doc doc/README.rst RELEASE.md
%{python_sitearch}/pandas/
%{python_sitearch}/pandas-%{version}-py*.egg-info
%endif
%changelog