Add gating tests

This commit is contained in:
Tomas Halman 2024-04-02 18:31:12 +02:00
parent d1432ef860
commit e7e76c0934
5 changed files with 77 additions and 1 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -3,7 +3,7 @@
Name: python-oauthlib
Version: 3.2.2
Release: 4%{?dist}
Release: 5%{?dist}
Summary: An implementation of the OAuth request-signing logic
License: BSD-3-Clause
@ -74,6 +74,9 @@ echo 'import pytest; __getattr__ = lambda _: pytest.skip("this test needs jwt")'
%doc README.rst
%changelog
* Wed Jul 3 2024 Tomas Halman <thalman@redhat.com> - 3.2.2-5
- Add gating tests
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 3.2.2-4
- Bump release for June 2024 mass rebuild

48
tests/oauthtests.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash -x
die () {
echo "$1" >&2
exit 1
}
SITEDIR=`python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'`
if [ "$SITEDIR" == "" ]; then
die "Can't locate python site dir"
fi
#
# install dependencies (pytest & blinker)
#
rm -rf venv
python3 -m venv venv
. venv/bin/activate
pip install -r requirements-tests.txt
# rename source code directory to be sure that we are
# testing files from our rpm
cd source || die "Missing source directory!"
if [ -d oauthlib ] ; then
mv oauthlib oauthlib.backup || die "Can't rename/hide source code directory!"
fi
ln -s $SITEDIR/oauthlib || die "Can't locate installed library"
#
# run upstream tests, skip jwt tests
#
echo 'import pytest; __getattr__ = lambda _: pytest.skip("this test needs jwt")' > jwt.py
pytest tests -p no:warnings --ignore tests/oauth2/rfc6749/clients/test_service_application.py | tee oauthlib.log
RESULT=${PIPESTATUS[0]}
#
# cleanup
#
rm jwt.py
if [ -L oauthlib ] ; then
rm oauthlib
fi
if [ -d oauthlib.backup ] ; then
mv oauthlib.backup oauthlib
fi
exit $RESULT

View File

@ -0,0 +1,2 @@
blinker==1.5
pytest==7.2

17
tests/tests.yml Normal file
View File

@ -0,0 +1,17 @@
---
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
- role: standard-test-basic
tags:
- classic
required_packages:
- python3-oauthlib
tests:
- oauthtests:
dir: .
run: ./oauthtests.sh
save-files: ["source/*.log"]