17
0
2024-01-10 10:05:49 +00:00
committed by Git OBS Bridge
parent 6993e4a645
commit 07565e0803
3 changed files with 37 additions and 7 deletions

3
_multibuild Normal file
View File

@@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jan 10 10:05:24 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Run tests using multibuild
-------------------------------------------------------------------
Tue Jan 9 07:36:26 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>

View File

@@ -1,5 +1,5 @@
#
# spec file for package python-google-cloud-spanner
# spec file
#
# Copyright (c) 2024 SUSE LLC
#
@@ -16,8 +16,17 @@
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-google-cloud-spanner
Name: python-google-cloud-spanner%{psuffix}
Version: 3.40.1
Release: 0
Summary: Google Cloud Spanner API client library
@@ -29,13 +38,17 @@ BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: python-rpm-macros
# SECTION test requirements
%if %{with test}
BuildRequires: %{python_module google-api-core >= 1.34.0}
BuildRequires: %{python_module google-cloud-core >= 1.4.1}
BuildRequires: %{python_module google-cloud-spanner = %{version}}
BuildRequires: %{python_module grpc-google-iam-v1 >= 0.12.4}
BuildRequires: %{python_module proto-plus >= 1.22.0}
BuildRequires: %{python_module protobuf >= 3.19.5}
BuildRequires: %{python_module pytest-asyncio}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module sqlparse >= 0.4.4}
%endif
# /SECTION
BuildRequires: fdupes
Requires: python-google-api-core >= 1.34.0
@@ -57,20 +70,28 @@ Google Cloud Spanner API client library
%prep
%autosetup -p1 -n google-cloud-spanner-%{version}
# don't use python-mock
for i in $(find tests -name "*.py")
do
sed -i 's/^import mock/from unittest import mock/g' $i
done
%build
%pyproject_wheel
%install
%if %{without test}
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%check
echo 0
# TODO: enable tests. I need to find a way to fix the python path
# because it loads the /usr/lib/$python/site-packages/google for
# dependencies and there it can't find the new package.
#%%pytest
%if %{with test}
export GOOGLE_CLOUD_PROJECT="PROJECT"
%pytest -x tests/unit
%endif
%if %{without test}
%files %{python_files}
%doc README.rst
%license LICENSE
@@ -78,5 +99,6 @@ echo 0
%{python_sitelib}/google_cloud_spanner-%{version}-*-nspkg.pth
%{python_sitelib}/google/cloud/spanner*
%{python_sitelib}/google_cloud_spanner-%{version}.dist-info
%endif
%changelog