Run tests using source from GitHub

This commit is contained in:
Major Hayden 2022-06-27 14:19:03 -05:00
commit 70b2af8654
No known key found for this signature in database
GPG key ID: 737051E0C1011FB1
4 changed files with 39 additions and 7 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/azure-batch-10.0.0.zip
/azure-batch-11.0.0.zip
/azure-batch-12.0.0.zip
/azure-batch-12.0.0.tgz

25
generate-source.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash
set -euxo pipefail
export VERSION=12.0.0
export PACKAGE_NAME=azure-batch
WORKING_DIR=$(pwd)
# Download the release and unpack it.
curl -LO https://github.com/Azure/azure-sdk-for-python/archive/refs/tags/${PACKAGE_NAME}_${VERSION}.tar.gz
tar xzf ${PACKAGE_NAME}_${VERSION}.tar.gz
# Find the package directory in the SDK release and the parent directory.
PACKAGE_DIR=$(find azure-sdk-for-python-${PACKAGE_NAME}_${VERSION} -type d -name $PACKAGE_NAME)
PARENT_DIR=$(dirname $PACKAGE_DIR)
# Build a tarball with a prefix directory that contains the package name and
# version. Store that in the directory where the script is running.
pushd $PARENT_DIR
tar --transform "s/^${PACKAGE_NAME}/${PACKAGE_NAME}-${VERSION}/" -cz \
-f ${WORKING_DIR}/${PACKAGE_NAME}-${VERSION}.tgz $PACKAGE_NAME
popd
# Clean up.
rm -f tar xzf ${PACKAGE_NAME}_${VERSION}.tar.gz
rm -rf azure-sdk-for-python-${PACKAGE_NAME}_${VERSION}

View file

@ -1,6 +1,6 @@
# NOTE(mhayden): The tests require network access to talk to some Azure
# endpoints, so the tests are disabled for now. 😞
%bcond_with tests
%bcond_without tests
%global srcname azure-batch
@ -10,7 +10,9 @@ Release: %autorelease
Summary: Microsoft Azure Batch Client Library for Python
License: MIT
URL: https://pypi.org/project/%{srcname}/
Source0: %{pypi_source %{srcname} %{version} zip}
# This source comes from making a git archive of the main azure-sdk-for-python
# repository. To reproduce the source code, run the generate-source.sh script.
Source0: %{srcname}-%{version}.tgz
BuildArch: noarch
@ -24,6 +26,7 @@ BuildRequires: python3dist(azure-mgmt-resource)
BuildRequires: python3dist(azure-sdk-tools)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-aiohttp)
BuildRequires: python3dist(python-dotenv)
%endif
%global _description %{expand:
@ -34,7 +37,6 @@ Microsoft Azure Batch Client Library for Python}
%package -n python3-%{srcname}
Summary: %{summary}
Obsoletes: python3-azure-sdk < 5.0.1
%description -n python3-%{srcname} %{_description}
@ -44,7 +46,7 @@ Obsoletes: python3-azure-sdk < 5.0.1
%generate_buildrequires
%pyproject_buildrequires -r
%pyproject_buildrequires
%build
@ -56,9 +58,13 @@ Obsoletes: python3-azure-sdk < 5.0.1
%pyproject_save_files azure
%if %{with tests}
%check
%pytest --disable-warnings
%pyproject_check_import
%if %{with tests}
%pytest \
-k "not test_batch_applications \
and not test_batch_files"
%endif

View file

@ -1 +1 @@
SHA512 (azure-batch-12.0.0.zip) = 65e2f0af942baf28fec2219e906ef776d032128bba8b1d062e984e632eb73c2807846510c7d248e5609121cd8e338ea0c56dcbd2ba448bba86cb33c79396ddfa
SHA512 (azure-batch-12.0.0.tgz) = a3db8d9fc6e88ed32bc048872328c482c93640704d1f831c50a3c3efcf67043ac80d9a56aeb1b8e5760ca5c6470a0a4e41e89543af9a3fb400deaff0a59183a7