#
# spec file for package python-parameterized
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%bcond_with ringdisabled
%if %{with ringdisabled}
# nose2 is actively maintained, but not used much in the distribution. No need to test it in ring1
%bcond_with nose2
%else
%bcond_without nose2
%endif

%{?sle15_python_module_pythons}
Name:           python-parameterized
Version:        0.9.0
Release:        4.5
Summary:        Parameterized testing
License:        BSD-2-Clause
URL:            https://github.com/wolever/parameterized
Source:         https://files.pythonhosted.org/packages/source/p/parameterized/parameterized-%{version}.tar.gz
# PATCH-FIX-OPENSUSE remove_nose.patch mcepl@suse.com
# Remove nose dependency (patch is not very good, DO NOT SEND UPSTREAM!)
Patch1:         remove_nose.patch
# PATCH-FIX-UPSTREAM skip_failing_teardown.patch gh#wolever/parameterized#167 mcepl@suse.com
# skip failing assert in tearDownModule [sic]
Patch2:         skip_failing_teardown.patch
# PATCH-FIX-UPSTREAM gh#wolever/parameterized#169
Patch3:         fix-assert-method.patch
# PATCH-FIX-UPSTREAM gh#wolever/parameterized#176
Patch4:         fix-tests-with-python3.13.patch
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module wheel}
%if %{with nose2}
BuildRequires:  %{python_module nose2}
%endif
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildArch:      noarch
%python_subpackages

%description
Parameterized testing with any Python test framework.

%prep
%autosetup -p1 -n parameterized-%{version}

%build
%pyproject_wheel

%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

%check
# https://github.com/wolever/parameterized/issues/122
sed -i 's:import mock:from unittest import mock:' parameterized/test.py
export LANG=en_US.UTF8
%if %{with nose2}
%{python_expand nose2-%$python_version -v -B --pretty-assert}
%endif
%python_exec -m unittest parameterized.test
# gh#wolever/parameterized#122
skip_tests="test_with_docstring_1_v_l_ or test_with_docstring_0_value1"
%pytest parameterized/test.py -k "not ($skip_tests)"

%files %{python_files}
%doc README.rst
# gh#wolever/parameterized#168
# %%doc CHANGELOG.txt
%license LICENSE.txt
%{python_sitelib}/parameterized
%{python_sitelib}/parameterized-%{version}.dist-info

%changelog
* Mon Jul 22 2024 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Cherry-pick upstream patch to fix tests with Python 3.13
  * fix-tests-with-python3.13.patch
* Tue Aug 15 2023 Steve Kowalik <steven.kowalik@suse.com>
- Add patch fix-assert-method.patch:
  * Use correct assertion method.
* Fri May 12 2023 Matej Cepl <mcepl@suse.com>
- Update to 0.9.0:
  - Drop support for Python 2.X, 3.5, and 3.6;
    Add support for Python 3.10, 3.11
  - Modernize from setup.py -> pyproject.toml
  - Add ``namespace`` argument to ``@parameterize.expand``
  - Add support for ``IsolatedAsyncioTestCase``
  - Work around for bug bpo-40126 in older versions of ``mock``
  - Allow str, bytes, and any non-iterable input to be passed to
    ``@parameterized`` without wrapping in a tuple
  - Fix class-level ``mock.patch.multiple``
- Add skip_failing_teardown.patch (gh#wolever/parameterized#167)
  to overcome failing tearDownModule().
- Remove upstreamed parameterized-pr116-pytest4.patch
* Fri Apr 21 2023 Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
* Thu Apr 13 2023 Matej Cepl <mcepl@suse.com>
- Make calling of %%{sle15modernpython} optional.
* Fri Aug 19 2022 Ben Greiner <code@bnavigator.de>
- Disable testing with nose2
  * nose2 is actively maintained, but not used much in the
    distribution. No need to test it in Ring1.
* Thu Apr 14 2022 Ben Greiner <code@bnavigator.de>
- Add parameterized-pr116-pytest4.patch for pytest 4 to 7 (!)
  support -- gh#wolever/parameterized#116
- Refresh remove_nose.patch
- Drop skip_Documentation_tests.patch fixed upstream
* Thu Apr  7 2022 pgajdos@suse.com
- version update to 0.8.1
  0.8.1 (2021-01-09)
  * Add README and LICENSE to pypi sdist package
    (https://github.com/wolever/parameterized/pull/114; thanks @chohner)
  0.8.0 (2021-01-04)
  * Handle camelCase test names. This is an ever-so-slightly backwards
    incompatible change, as the method for determining which methods are
    test methods has changed from ``method_name.startswith("test_")`` to
    ``method_name.startswith("test")``. The latter is the behavior of
    the ``unittest`` module.
    (thanks @bobwalker99; https://github.com/wolever/parameterized/pull/106)
  * Fix arguments to skip_on_empty helper (thanks @bhavyakjain;
    https://github.com/wolever/parameterized/pull/104)
  0.7.5 (2021-01-04)
  * Fix crash on Python 2.7 with unicode docstrings
    (https://github.com/wolever/parameterized/issues/109)
  * Replace inspect.stack() with faster inspect.currentframe()
    (https://github.com/wolever/parameterized/issues/107)
  * Add a __version__ string to the package
    (https://github.com/wolever/parameterized/issues/103)
* Mon Sep 14 2020 Matej Cepl <mcepl@suse.com>
- Add remove_nose.patch to eliminate nose dependency. The patch
  is not very good, it still skips plenty of yield tests (which
  were ignored even before, so it is not even a regression).
* Fri Aug 14 2020 John Vandenberg <jayvdb@gmail.com>
- Re-activate testing with pytest runner
* Tue Jun  2 2020 pgajdos@suse.com
- version update to 0.7.4
  * Add ``class_name_func`` option to ``@parameterized_class``
  * Fix arguments being passed to skip_on_empty_helper (thanks @gaf3;
    https://github.com/wolever/parameterized/issues/57)
  * Fix tests on Python 3.8.2 (thanks @Ikke;
    https://github.com/wolever/parameterized/pull/99)
  * Fix some typos (thanks @LWprogramming, @jinnovation;
    https://github.com/wolever/parameterized/pull/77,
    https://github.com/wolever/parameterized/pull/80)
  * Fix unicode handling in setup.py (thanks @sliwinski-milosz;
    https://github.com/wolever/parameterized/pull/89)
  * Fix Python 3.9 compat (thanks @vstinner;
    https://github.com/wolever/parameterized/pull/94)
  * Add `@parameterized_class` name function callback support (thanks
    @duncwebb et al; https://github.com/wolever/parameterized/pull/74)
- drop dependency on unittest2
* Fri Dec 13 2019 John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Include in SLE-15 (bsc#1159018, jsc#PM-1507)
* Thu Dec  5 2019 Matej Cepl <mcepl@suse.com>
- Update to 0.7.1:
  - calling `setUp` and `tearDown` in parameterized classesq
- Add skip_Documentation_tests.patch to skip over test cases,
  failing with Python 3.8. gh#wolever/parameterized#84
* Tue Nov  5 2019 Ondřej Súkup <mimi.vx@gmail.com>
- remove pytest test, enable other test frameworks
* Wed Aug 21 2019 Tomáš Chvátal <tchvatal@suse.com>
- Use pytest 3.x series as newer use different syntax
* Fri Mar 15 2019 Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.7.0:
  * Added parameterized_class feature, for parameterizing entire test
    classes (many thanks to @TobyLL for their suggestions and help testing!)
  * Fix DeprecationWarning on `inspect.getargs` (thanks @brettdh;
    https://github.com/wolever/parameterized/issues/67)
  * Make sure that `setUp` and `tearDown` methods work correctly (#40)
  * Raise a ValueError when input is empty (thanks @danielbradburn;
    https://github.com/wolever/parameterized/pull/48)
  * Fix the order when number of cases exceeds 10 (thanks @ntflc;
    https://github.com/wolever/parameterized/pull/49)
* Tue Dec  4 2018 Matej Cepl <mcepl@suse.com>
- Remove superfluous devel dependency for noarch package
* Wed May 16 2018 toddrme2178@gmail.com
- Use license tag
* Sun Oct 22 2017 toddrme2178@gmail.com
- Initial version