Skip to content

Commit

Permalink
Tester: allow include/exclude list to also be newline separated
Browse files Browse the repository at this point in the history
Tests can be configured with newlines now:

  [tests]
  include =
  	patch/one
  	patch/two

Signed-off-by: Kees Cook <[email protected]>
  • Loading branch information
kees authored and kuba-moo committed Sep 27, 2022
1 parent 14df5ef commit e8d8e70
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import configparser
import os
import threading
import re

import core
from core import Test, PullError
Expand All @@ -15,11 +16,8 @@
def load_tests(config, name):
core.log_open_sec(name.capitalize() + " tests")
tests_subdir = os.path.join(config.get('dirs', 'tests'), name)
try:
include = [x.strip() for x in config.get('tests', 'include').split(',')]
except (configparser.NoSectionError, configparser.NoOptionError):
include = []
exclude = [x.strip() for x in config.get('tests', 'exclude', fallback="").split(',')]
include = [x.strip() for x in re.split(r'[,\n]', config.get('tests', 'include', fallback="")) if len(x)]
exclude = [x.strip() for x in re.split(r'[,\n]', config.get('tests', 'exclude', fallback="")) if len(x)]
tests = []
for td in os.listdir(tests_subdir):
test = f'{name}/{td}'
Expand Down

0 comments on commit e8d8e70

Please sign in to comment.