Add gating tests

Related: rhbz#1984046 - python-oauthlib depends on jwt for RSA
This commit is contained in:
Tomas Halman 2022-10-24 14:54:51 +02:00
parent cb39b7bb56
commit 66e06ec893
4 changed files with 73 additions and 0 deletions

6
gating.yaml Normal file
View File

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

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"]