2018-08-14 20:33:04 +00:00
|
|
|
#
|
2021-04-19 05:21:23 +00:00
|
|
|
# spec file for package python-pytest-arraydiff-test
|
2018-08-14 20:33:04 +00:00
|
|
|
#
|
2021-04-19 05:21:23 +00:00
|
|
|
# Copyright (c) 2021 SUSE LLC
|
2018-08-14 20:33:04 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2019-02-13 13:27:45 +00:00
|
|
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
|
|
|
#
|
2018-08-14 20:33:04 +00:00
|
|
|
|
|
|
|
|
2019-02-13 13:27:45 +00:00
|
|
|
%global flavor @BUILD_FLAVOR@%{nil}
|
|
|
|
%if "%{flavor}" == "test"
|
|
|
|
%define psuffix -test
|
|
|
|
%bcond_without test
|
|
|
|
%else
|
|
|
|
%define psuffix %{nil}
|
|
|
|
%bcond_with test
|
|
|
|
%endif
|
2021-04-27 11:17:51 +00:00
|
|
|
|
|
|
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
|
|
|
%define skip_python36 1
|
2019-02-13 13:27:45 +00:00
|
|
|
Name: python-pytest-arraydiff%{psuffix}
|
|
|
|
Version: 0.3
|
2018-08-14 20:33:04 +00:00
|
|
|
Release: 0
|
|
|
|
Summary: Pytest plugin to help with comparing array output from tests
|
2019-02-13 13:27:45 +00:00
|
|
|
License: BSD-2-Clause
|
2021-04-27 11:17:51 +00:00
|
|
|
URL: https://github.com/astropy/pytest-arraydiff
|
2018-08-14 20:33:04 +00:00
|
|
|
Source: https://files.pythonhosted.org/packages/source/p/pytest-arraydiff/pytest-arraydiff-%{version}.tar.gz
|
|
|
|
BuildRequires: %{python_module setuptools}
|
|
|
|
BuildRequires: fdupes
|
|
|
|
BuildRequires: python-rpm-macros
|
|
|
|
Requires: python-numpy
|
|
|
|
Requires: python-pytest
|
|
|
|
Requires: python-six
|
|
|
|
BuildArch: noarch
|
2019-02-13 13:27:45 +00:00
|
|
|
%if %{with test}
|
2021-04-27 11:17:51 +00:00
|
|
|
BuildRequires: %{python_module astropy if %python-base > 3}
|
2019-02-13 13:27:45 +00:00
|
|
|
BuildRequires: %{python_module numpy}
|
|
|
|
BuildRequires: %{python_module pytest}
|
|
|
|
BuildRequires: %{python_module six}
|
|
|
|
%endif
|
2018-08-14 20:33:04 +00:00
|
|
|
%python_subpackages
|
|
|
|
|
|
|
|
%description
|
|
|
|
This is a py.test plugin to facilitate the generation and comparison of
|
|
|
|
data arrays produced during tests.
|
|
|
|
|
|
|
|
The basic idea is that you can write a test that generates a Numpy array (or
|
|
|
|
other related objects depending on the format). You can then either run the
|
|
|
|
tests in a mode to generate reference files from the arrays, or you can run
|
|
|
|
the tests in comparison mode, which will compare the results of the tests to
|
|
|
|
the reference ones within some tolerance.
|
|
|
|
|
|
|
|
At the moment, the supported file formats for the reference files are:
|
|
|
|
|
|
|
|
- A plain text-based format (baSed on Numpy loadtxt output)
|
|
|
|
- The FITS format (requires astropy). With this format, tests
|
|
|
|
can return either a Numpy array for a FITS HDU object.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n pytest-arraydiff-%{version}
|
|
|
|
|
|
|
|
%build
|
|
|
|
%python_build
|
|
|
|
|
|
|
|
%install
|
2019-02-13 13:27:45 +00:00
|
|
|
%if !%{with test}
|
2018-08-14 20:33:04 +00:00
|
|
|
%python_install
|
|
|
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
2019-02-13 13:27:45 +00:00
|
|
|
%endif
|
|
|
|
|
|
|
|
%if %{with test}
|
|
|
|
%check
|
2021-04-27 11:17:51 +00:00
|
|
|
%{python_expand # u-a controlled pytest executable for nested pytest calls within tests
|
|
|
|
mkdir -p build/bin
|
|
|
|
ln -sf %{_bindir}/pytest-%{$python_bin_suffix} build/bin/pytest
|
|
|
|
}
|
|
|
|
export PATH="$PWD/build/bin:$PATH"
|
|
|
|
# not installed in :test multiflavor
|
|
|
|
export PYTHONPATH="$PWD"
|
2019-05-06 09:16:24 +00:00
|
|
|
# generate, default_format, test_fails, test_succeeds_func_fits_hdu tests need astropy that is python3 only, so skip
|
2021-04-27 11:17:51 +00:00
|
|
|
python2_donttest=" or test_generate or test_default_format or test_fails or test_succeeds_func_fits_hdu"
|
|
|
|
%pytest -k "not (donttestdummyprefix ${$python_donttest})"
|
2019-02-13 13:27:45 +00:00
|
|
|
%endif
|
2018-08-14 20:33:04 +00:00
|
|
|
|
2019-02-13 13:27:45 +00:00
|
|
|
%if !%{with test}
|
2018-08-14 20:33:04 +00:00
|
|
|
%files %{python_files}
|
|
|
|
%doc CHANGES.md README.rst
|
|
|
|
%license LICENSE
|
2021-04-27 11:17:51 +00:00
|
|
|
%{python_sitelib}/pytest_arraydiff
|
|
|
|
%{python_sitelib}/pytest_arraydiff-%{version}*-info
|
2019-02-13 13:27:45 +00:00
|
|
|
%endif
|
2018-08-14 20:33:04 +00:00
|
|
|
|
|
|
|
%changelog
|