Accepting request 909017 from home:mcepl:branches:devel:languages:python
- Update to 2.2.0: - #45: num_regression.check now accepts any object that can be coerced to a 1d numpy array with numeric dtype (e.g. list, tuple, etc). - #35: New dataframe_regression fixture to check pandas DataFrames directly. - #34: Fix data_regression bug that creates empty file on serializing error. - Add np_num-deprecated.patch to avoid tests failing on using deprecated data types (gh#ESSS/pytest-regressions#63). OBS-URL: https://build.opensuse.org/request/show/909017 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-regressions?expand=0&rev=1
This commit is contained in:
commit
8b55f37225
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
97
np_num-deprecated.patch
Normal file
97
np_num-deprecated.patch
Normal file
@ -0,0 +1,97 @@
|
||||
---
|
||||
src/pytest_regressions/dataframe_regression.py | 4 ++--
|
||||
tests/test_dataframe_regression.py | 8 ++++----
|
||||
tests/test_num_regression.py | 10 +++++-----
|
||||
3 files changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
--- a/src/pytest_regressions/dataframe_regression.py
|
||||
+++ b/src/pytest_regressions/dataframe_regression.py
|
||||
@@ -123,7 +123,7 @@ class DataFrameRegressionFixture:
|
||||
self._check_data_shapes(obtained_column, expected_column)
|
||||
|
||||
data_type = obtained_column.values.dtype
|
||||
- if data_type in [float, np.float, np.float16, np.float32, np.float64]:
|
||||
+ if data_type in [float, np.float16, np.float32, np.float64]:
|
||||
not_close_mask = ~np.isclose(
|
||||
obtained_column.values,
|
||||
expected_column.values,
|
||||
@@ -137,7 +137,7 @@ class DataFrameRegressionFixture:
|
||||
diff_ids = np.where(not_close_mask)[0]
|
||||
diff_obtained_data = obtained_column[diff_ids]
|
||||
diff_expected_data = expected_column[diff_ids]
|
||||
- if data_type == np.bool:
|
||||
+ if data_type == bool:
|
||||
diffs = np.logical_xor(obtained_column, expected_column)[diff_ids]
|
||||
else:
|
||||
diffs = np.abs(obtained_column - expected_column)[diff_ids]
|
||||
--- a/tests/test_dataframe_regression.py
|
||||
+++ b/tests/test_dataframe_regression.py
|
||||
@@ -193,7 +193,7 @@ def test_arrays_with_different_sizes(dat
|
||||
|
||||
|
||||
def test_integer_values_smoke_test(dataframe_regression, no_regen):
|
||||
- data1 = np.ones(11, dtype=np.int)
|
||||
+ data1 = np.ones(11, dtype=int)
|
||||
dataframe_regression.check(pd.DataFrame.from_dict({"data1": data1}))
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ def test_number_formats(dataframe_regres
|
||||
|
||||
|
||||
def test_bool_array(dataframe_regression, no_regen):
|
||||
- data1 = np.array([True, True, True], dtype=np.bool)
|
||||
+ data1 = np.array([True, True, True], dtype=bool)
|
||||
with pytest.raises(AssertionError) as excinfo:
|
||||
dataframe_regression.check(pd.DataFrame.from_dict({"data1": data1}))
|
||||
obtained_error_msg = str(excinfo.value)
|
||||
@@ -228,8 +228,8 @@ def test_bool_array(dataframe_regression
|
||||
|
||||
def test_arrays_of_same_size(dataframe_regression):
|
||||
same_size_int_arrays = {
|
||||
- "hello": np.zeros((1,), dtype=np.int),
|
||||
- "world": np.zeros((1,), dtype=np.int),
|
||||
+ "hello": np.zeros((1,), dtype=int),
|
||||
+ "world": np.zeros((1,), dtype=int),
|
||||
}
|
||||
dataframe_regression.check(pd.DataFrame.from_dict(same_size_int_arrays))
|
||||
|
||||
--- a/tests/test_num_regression.py
|
||||
+++ b/tests/test_num_regression.py
|
||||
@@ -169,7 +169,7 @@ def test_different_data_types(num_regres
|
||||
|
||||
|
||||
def test_n_dimensions(num_regression, no_regen):
|
||||
- data1 = np.ones(shape=(10, 10), dtype=np.int)
|
||||
+ data1 = np.ones(shape=(10, 10), dtype=int)
|
||||
with pytest.raises(
|
||||
AssertionError,
|
||||
match="Only 1D arrays are supported on num_data_regression fixture.",
|
||||
@@ -186,7 +186,7 @@ def test_arrays_with_different_sizes(num
|
||||
|
||||
|
||||
def test_integer_values_smoke_test(num_regression, no_regen):
|
||||
- data1 = np.ones(11, dtype=np.int)
|
||||
+ data1 = np.ones(11, dtype=int)
|
||||
num_regression.check({"data1": data1})
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ def test_fill_different_shape_with_nan_f
|
||||
|
||||
|
||||
def test_bool_array(num_regression, no_regen):
|
||||
- data1 = np.array([True, True, True], dtype=np.bool)
|
||||
+ data1 = np.array([True, True, True], dtype=bool)
|
||||
with pytest.raises(AssertionError) as excinfo:
|
||||
num_regression.check({"data1": data1})
|
||||
obtained_error_msg = str(excinfo.value)
|
||||
@@ -253,8 +253,8 @@ def test_bool_array(num_regression, no_r
|
||||
|
||||
def test_arrays_of_same_size(num_regression):
|
||||
same_size_int_arrays = {
|
||||
- "hello": np.zeros((1,), dtype=np.int),
|
||||
- "world": np.zeros((1,), dtype=np.int),
|
||||
+ "hello": np.zeros((1,), dtype=int),
|
||||
+ "world": np.zeros((1,), dtype=int),
|
||||
}
|
||||
num_regression.check(same_size_int_arrays)
|
||||
|
3
pytest-regressions-2.2.0.tar.gz
Normal file
3
pytest-regressions-2.2.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:15a71f77cb266dd4ca94331abe4c339ad056b2b2175e47442711c98cf6d65716
|
||||
size 98162
|
17
python-pytest-regressions.changes
Normal file
17
python-pytest-regressions.changes
Normal file
@ -0,0 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 28 19:42:17 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Update to 2.2.0:
|
||||
- #45: num_regression.check now accepts any object that can be coerced
|
||||
to a 1d numpy array with numeric dtype (e.g. list, tuple, etc).
|
||||
- #35: New dataframe_regression fixture to check pandas DataFrames
|
||||
directly.
|
||||
- #34: Fix data_regression bug that creates empty file on serializing
|
||||
error.
|
||||
- Add np_num-deprecated.patch to avoid tests failing on using deprecated
|
||||
data types (gh#ESSS/pytest-regressions#63).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 20 06:26:22 AM UTC 2020 - John Vandenberg <jayvdb@gmail.com>
|
||||
|
||||
- Initial spec for v2.0.1
|
76
python-pytest-regressions.spec
Normal file
76
python-pytest-regressions.spec
Normal file
@ -0,0 +1,76 @@
|
||||
#
|
||||
# spec file for package python-pytest-regressions
|
||||
#
|
||||
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
%define skip_python36 1
|
||||
Name: python-pytest-regressions
|
||||
Version: 2.2.0
|
||||
Release: 0
|
||||
License: MIT
|
||||
Summary: Python fixtures to write regression tests
|
||||
Url: https://github.com/ESSS/pytest-regressions
|
||||
Group: Development/Languages/Python
|
||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-regressions/pytest-regressions-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM np_num-deprecated.patch gh#ESSS/pytest-regressions#63 mcepl@suse.com
|
||||
# don't use deprecated np.* types
|
||||
Patch0: np_num-deprecated.patch
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module setuptools_scm}
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module pytest >= 3.5.0}
|
||||
BuildRequires: %{python_module pytest-datadir >= 1.2.0}
|
||||
BuildRequires: %{python_module PyYAML}
|
||||
BuildRequires: %{python_module matplotlib}
|
||||
BuildRequires: %{python_module numpy}
|
||||
BuildRequires: %{python_module pandas}
|
||||
BuildRequires: %{python_module Pillow}
|
||||
# /SECTION
|
||||
BuildRequires: fdupes
|
||||
Requires: python-pytest >= 3.5.0
|
||||
Requires: python-pytest-datadir >= 1.2.0
|
||||
Requires: python-PyYAML
|
||||
Suggests: python-matplotlib
|
||||
Suggests: python-numpy
|
||||
Suggests: python-pandas
|
||||
Suggests: python-Pillow
|
||||
BuildArch: noarch
|
||||
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
Python fixtures to write regression tests.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n pytest-regressions-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest
|
||||
|
||||
%files %{python_files}
|
||||
%doc CHANGELOG.rst README.rst
|
||||
%license LICENSE
|
||||
%{python_sitelib}/pytest_regressions*
|
||||
|
||||
%changelog
|
Loading…
Reference in New Issue
Block a user