From e7e76c0934294bb631caf23402f03795e6151036 Mon Sep 17 00:00:00 2001 From: Tomas Halman Date: Tue, 2 Apr 2024 18:31:12 +0200 Subject: [PATCH] Add gating tests --- gating.yaml | 6 +++++ python-oauthlib.spec | 5 +++- tests/oauthtests.sh | 48 ++++++++++++++++++++++++++++++++++++ tests/requirements-tests.txt | 2 ++ tests/tests.yml | 17 +++++++++++++ 5 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 gating.yaml create mode 100755 tests/oauthtests.sh create mode 100644 tests/requirements-tests.txt create mode 100644 tests/tests.yml diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..4ca9235 --- /dev/null +++ b/gating.yaml @@ -0,0 +1,6 @@ +--- !Policy +product_versions: + - rhel-10 +decision_context: osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/python-oauthlib.spec b/python-oauthlib.spec index 90eab9b..cbebb67 100644 --- a/python-oauthlib.spec +++ b/python-oauthlib.spec @@ -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 - 3.2.2-5 +- Add gating tests + * Mon Jun 24 2024 Troy Dawson - 3.2.2-4 - Bump release for June 2024 mass rebuild diff --git a/tests/oauthtests.sh b/tests/oauthtests.sh new file mode 100755 index 0000000..cbe06d0 --- /dev/null +++ b/tests/oauthtests.sh @@ -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 diff --git a/tests/requirements-tests.txt b/tests/requirements-tests.txt new file mode 100644 index 0000000..176ffef --- /dev/null +++ b/tests/requirements-tests.txt @@ -0,0 +1,2 @@ +blinker==1.5 +pytest==7.2 diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..e44be58 --- /dev/null +++ b/tests/tests.yml @@ -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"]