From 421fd98a9c5d91ac7a9cf07bfc8fecd3704d824a Mon Sep 17 00:00:00 2001 From: Cyril Chapellier Date: Tue, 23 May 2023 09:24:55 +0200 Subject: [PATCH] [Tests] Only run SSL tests in Docker (#1918) * Only run SSL tests in docker workflow * Rename workflow --- .github/workflows/workflow.yml | 8 ++++---- tests/__init__.py | 3 +++ tox.ini | 11 +++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 67052e84..44428e1e 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -10,8 +10,8 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: - test-with-ssl: - name: Test all, including SSL tests + ssl-test: + name: Run SSL tests runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 @@ -21,11 +21,11 @@ jobs: file: tests/Dockerfile tags: rqtest-image:latest push: false - - name: Launch tox for all test scenarii + - name: Launch tox SSL env only (will only run SSL specific tests) uses: addnab/docker-run-action@v3 with: image: rqtest-image:latest - run: stunnel & redis-server & RUN_SSL_TESTS=1 tox + run: stunnel & redis-server & RUN_SSL_TESTS=1 tox run -e ssl test: name: Python${{ matrix.python-version }}/Redis${{ matrix.redis-version }}/redis-py${{ matrix.redis-py-version }} diff --git a/tests/__init__.py b/tests/__init__.py index 9da4687d..3451eb37 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -2,6 +2,7 @@ import logging import os import unittest +import pytest from redis import Redis from rq import pop_connection, push_connection @@ -25,10 +26,12 @@ def find_empty_redis_database(ssl=False): def slow(f): + f = pytest.mark.slow(f) return unittest.skipUnless(os.environ.get('RUN_SLOW_TESTS_TOO'), "Slow tests disabled")(f) def ssl_test(f): + f = pytest.mark.ssl_test(f) return unittest.skipUnless(os.environ.get('RUN_SSL_TESTS'), "SSL tests disabled")(f) diff --git a/tox.ini b/tox.ini index 23bb843c..a180d777 100644 --- a/tox.ini +++ b/tox.ini @@ -45,3 +45,14 @@ deps = {[testenv]deps} skipdist = True basepython = python3.10 deps = {[testenv]deps} + +[testenv:ssl] +skipdist = True +basepython = python3.10 +deps= + pytest + sentry-sdk + psutil +passenv= + RUN_SSL_TESTS +commands=pytest -m ssl_test {posargs}