## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    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:        3.1.3
Release:        %autorelease
Summary:        A pytest plugin for PostgreSQL database integration

License:        LGPLv3+
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:  libpq-devel
BuildRequires:  postgresql-server
BuildRequires:  python3-psycopg2
BuildRequires:  glibc-langpack-en
BuildRequires:  glibc-langpack-de

%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
%pytest --postgresql-exec="/usr/bin/pg_ctl" -k "not docker" --no-cov

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

%changelog
* 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