# Enable tests everywhere except EPEL 9, where flask/pytest-aiohttp are not backported.
%if 0%{?el9} || 0%{?centos} >= 9
%bcond_with tests
%else
%bcond_without tests
%endif
%global srcname azure-core
Name: python-%{srcname}
Version: 1.21.1
Release: %autorelease
Summary: Azure Core shared client library for Python
License: MIT
URL: https://pypi.org/project/%{srcname}/
Source0: %{pypi_source %{srcname} %{version} zip}
Epoch: 1
BuildArch: noarch
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3dist(azure-devtools)
BuildRequires: python3dist(azure-mgmt-keyvault)
BuildRequires: python3dist(azure-mgmt-resource)
BuildRequires: python3dist(azure-sdk-tools)
BuildRequires: python3dist(flask)
BuildRequires: python3dist(msrest)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-aiohttp)
BuildRequires: python3dist(trio)
%endif
%global _description %{expand:
Azure Core shared client library for Python}
%description %{_description}
%package -n python3-%{srcname}
Summary: %{summary}
Obsoletes: python3-azure-sdk < 5.0.1
%description -n python3-%{srcname} %{_description}
%prep
%autosetup -n %{srcname}-%{version}
%generate_buildrequires
%pyproject_buildrequires -r
%build
%pyproject_wheel
# Temporarily install the coretestserver package from the tests directory.
pushd tests/testserver_tests/coretestserver
%pyproject_wheel
popd
%install
%pyproject_install
%if %{with tests}
%check
# Disable some tests that require network access.
%pytest --disable-warnings tests \
--ignore=tests/test_streaming.py \
--ignore-glob=tests/async_tests/*.py \
-k "not test_decompress_plain_no_header \
and not test_compress_plain_no_header \
and not test_decompress_compressed_no_header \
and not test_decompress_compressed_header \
and not test_aiohttp_loop \
and not test_text_and_encoding"
# Remove the temporarily installed coretestserver.
rm -rf %{buildroot}%{python3_sitelib}/coretestserver*
%endif
%files -n python3-%{srcname}
%doc README.md
%{python3_sitelib}/azure
%{python3_sitelib}/azure_core-%{version}.dist-info
%changelog
%autochangelog