Skip to content

Commit

Permalink
Add option to all pytests to skip particular algorithms (#1282)
Browse files Browse the repository at this point in the history
* Add SKIP_ALGS option to all pytests to skip particular algorithms
  • Loading branch information
dstebila authored Aug 7, 2022
1 parent 84fde26 commit 42f36c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ jobs:
working-directory: build
- name: Run tests
timeout-minutes: 60
env:
SKIP_ALGS: "SPHINCS\\+-Haraka-256s-*"
run: mkdir -p tmp && python3 -m pytest --verbose --ignore=tests/test_code_conventions.py ${{ matrix.PYTEST_ARGS }}

linux_arm_emulated:
Expand Down
9 changes: 9 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import os.path
import pytest
import re
import subprocess
import sys
import json
Expand Down Expand Up @@ -112,6 +113,14 @@ def filtered_test(func):

@functools.wraps(func)
def wrapper(*args, **kwargs):
if ('SKIP_ALGS' in os.environ) and len(os.environ['SKIP_ALGS'])>0:
for algexp in os.environ['SKIP_ALGS'].split(','):
for arg in args:
if len(re.findall(algexp, arg))>0:
pytest.skip("Test disabled by alg filter")
for arg in kwargs:
if len(re.findall(algexp, kwargs[arg]))>0:
pytest.skip("Test disabled by alg filter")
if ('SKIP_TESTS' in os.environ) and (funcname in os.environ['SKIP_TESTS'].lower().split(',')):
pytest.skip("Test disabled by filter")
else:
Expand Down

0 comments on commit 42f36c2

Please sign in to comment.