## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 3;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global pypi_name pytest-postgresql
%global name_with_underscore pytest_postgresql

Name:           python-%{pypi_name}
Version:        6.0.0
Release:        %autorelease
Summary:        A pytest plugin for PostgreSQL database integration

License:        LGPL-3.0-or-later
URL:            https://github.com/ClearcodeHQ/pytest-postgresql
Source0:        https://github.com/ClearcodeHQ/pytest-postgresql/archive/v%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  pyproject-rpm-macros

# for check
BuildRequires:  glibc-langpack-en
BuildRequires:  glibc-langpack-de
BuildRequires:  libpq-devel
BuildRequires:  python3dist(psycopg)
BuildRequires:  postgresql-server

%description
This is a pytest plugin, that enables you to test your code that relies on a
running PostgreSQL Database. It allows you to specify fixtures for PostgreSQL
process and client.


%package -n     python3-%{pypi_name}
Summary:        %{summary}

%description -n python3-%{pypi_name}
This is a pytest plugin, that enables you to test your code that relies on a
running PostgreSQL Database. It allows you to specify fixtures for PostgreSQL
process and client.

%prep
%autosetup -n %{pypi_name}-%{version}

%generate_buildrequires
%pyproject_buildrequires -r -x tests

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files %{name_with_underscore}

%check
# Since 5.0.0 there are issues during the check phase as pytest-postgresql is
# loaded twice and pytest errors as same params are loaded twice.
#
# To fix:
#   - remove unkown params from pyproject.toml
#   - remove test_postgres_options_plugin.py to avoid failing tests
#   - "-p no:postgresql" to avoid loading the plugin twice
sed -i '/^addopts/d' pyproject.toml
rm tests/test_postgres_options_plugin.py
%pytest -p no:postgresql --postgresql-exec="/usr/bin/pg_ctl" -k "not docker"

%files -n python3-%{pypi_name} -f %{pyproject_files}
%license COPYING COPYING.lesser
%doc AUTHORS.rst CHANGES.rst README.rst

%changelog
## START: Generated by rpmautospec
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Thu Jun 13 2024 Python Maint <python-maint@redhat.com> - 6.0.0-2
- Rebuilt for Python 3.13

* Fri Apr 05 2024 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 6.0.0-1
- Update to 6.0.0 - Closes rhbz#2261886

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Thu Jul 06 2023 Python Maint <python-maint@redhat.com> - 4.1.1-2
- Rebuilt for Python 3.12

* Thu Jun 01 2023 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 4.1.1-1
- Update to 4.1.1 - Closes rhbz#2020851

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 3.1.3-2
- Rebuilt for Python 3.11

* Wed Mar 02 2022 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 3.1.3-1
- Update to 3.1.3 - Closes rhbz#2059939

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Oct 21 2021 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 3.1.2-1
- Update to 3.1.2 #2016263

* Tue Aug 10 2021 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 3.1.1-2
- Changes based on #1991138 review

* Fri Aug 06 2021 Mikel Olasagasti Uranga <mikel@olasagasti.info> - 3.1.1-1
- Initial version

## END: Generated by rpmautospec