Accepting request 1085835 from devel:languages:python:pytest

- update to 2.4.2:
  * Properly handle missing index ``0``.
  * Compatibility fix for pytest 6.2.
  * New ``--regen-all`` flag, which regenerates all files without
    failing the tests. Useful to regenerate all files in
    the test suite with a single run.
  * The public API is now fully type annotated.
  * ``pytest>=6.2`` is now required.
  * Properly handle empty and NaN values on
    num_regression and dataframe_regression.
  * New ``--with-test-class-names`` command-line flag to consider
    test class names when composing the expected and obtained
    data filenames. Needed when the same module contains
    different classes with the same method names.
  * New ``ndarrays_regression``, for comparing NumPy arrays with
    arbitrary shape.
  * Fix ``empty string bug`` on dataframe regression.
- drop np_num-deprecated.patch (upstream)

OBS-URL: https://build.opensuse.org/request/show/1085835
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-regressions?expand=0&rev=3
This commit is contained in:
Dominique Leuenberger 2023-05-10 14:17:23 +00:00 committed by Git OBS Bridge
commit 3d4463a6ba
5 changed files with 28 additions and 106 deletions

View File

@ -1,97 +0,0 @@
---
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)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:15a71f77cb266dd4ca94331abe4c339ad056b2b2175e47442711c98cf6d65716
size 98162

BIN
pytest-regressions-2.4.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Tue May 9 21:07:08 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 2.4.2:
* Properly handle missing index ``0``.
* Compatibility fix for pytest 6.2.
* New ``--regen-all`` flag, which regenerates all files without
failing the tests. Useful to regenerate all files in
the test suite with a single run.
* The public API is now fully type annotated.
* ``pytest>=6.2`` is now required.
* Properly handle empty and NaN values on
num_regression and dataframe_regression.
* New ``--with-test-class-names`` command-line flag to consider
test class names when composing the expected and obtained
data filenames. Needed when the same module contains
different classes with the same method names.
* New ``ndarrays_regression``, for comparing NumPy arrays with
arbitrary shape.
* Fix ``empty string bug`` on dataframe regression.
- drop np_num-deprecated.patch (upstream)
-------------------------------------------------------------------
Fri May 5 19:54:00 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -18,21 +18,18 @@
%{?sle15_python_module_pythons}
Name: python-pytest-regressions
Version: 2.2.0
Version: 2.4.2
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_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module pytest >= 3.5.0}
BuildRequires: %{python_module pytest >= 6.2.0}
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module PyYAML}
BuildRequires: %{python_module matplotlib}
@ -42,7 +39,7 @@ BuildRequires: %{python_module pytest-datadir >= 1.2.0}
# /SECTION
BuildRequires: fdupes
Requires: python-PyYAML
Requires: python-pytest >= 3.5.0
Requires: python-pytest >= 6.2.0
Requires: python-pytest-datadir >= 1.2.0
Suggests: python-matplotlib
Suggests: python-numpy