You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/06/02 02:06:37 UTC
[incubator-ponymail-unit-tests] branch master updated: allow
specifying which test type and/or generators to run
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git
The following commit(s) were added to refs/heads/master by this push:
new cec7418 allow specifying which test type and/or generators to run
cec7418 is described below
commit cec74186db5e2d4a3c681a22cc2f5d410d6e200c
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Jun 2 04:06:19 2021 +0200
allow specifying which test type and/or generators to run
---
runall.py | 20 +++++++++++++-------
tests/test-generators.py | 2 ++
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/runall.py b/runall.py
index a012411..c9ba603 100755
--- a/runall.py
+++ b/runall.py
@@ -15,6 +15,10 @@ if __name__ == '__main__':
help="Root directory of Apache Pony Mail")
parser.add_argument('--load', dest='load', type=str, nargs='+',
help="Load only specific yaml spec files instead of all test specs")
+ parser.add_argument('--ttype', dest='ttype', type=str, nargs='+',
+ help="Run only specified test types (generators, parsing, etc)")
+ parser.add_argument('--gtype', dest='gtype', type=str, nargs='+',
+ help="Run only specified generators (medium, cluster, dkim, full, etc)")
parser.add_argument('--yamldir', dest='yamldir', type=str, action='store',
help="Load yaml specs from alternate directory")
parser.add_argument('--nomboxo', dest = 'nomboxo', action='store_true',
@@ -43,6 +47,9 @@ if __name__ == '__main__':
yml = yaml.safe_load(f)
env = os.environ # always pass parent environ
for test_type in yml:
+ if args.ttype and test_type not in args.ttype:
+ print("Skipping test type %s due to --ttype flag" % test_type)
+ continue
if test_type == 'args':
# Environment variable override, e.g. MOCK_GMTIME
env_ = yml[test_type].get("env", None)
@@ -54,14 +61,13 @@ if __name__ == '__main__':
# Use stderr so appears in correct sequence in logs
print("Running '%s' tests from %s..." % (test_type, spec_file), file=sys.stderr)
try:
+ cliargs = [PYTHON3, 'tests/test-%s.py' % test_type, '--rootdir', args.rootdir, '--load', spec_file,]
if args.nomboxo:
- rv = subprocess.check_output(
- (PYTHON3, 'tests/test-%s.py' % test_type, '--rootdir', args.rootdir, '--load', spec_file, '--nomboxo'),
- env=env)
- else:
- rv = subprocess.check_output(
- (PYTHON3, 'tests/test-%s.py' % test_type, '--rootdir', args.rootdir, '--load', spec_file),
- env=env)
+ cliargs.append('--nomboxo')
+ if args.gtype:
+ cliargs.append('--generators')
+ cliargs.extend(args.gtype)
+ rv = subprocess.check_output(cliargs, env=env)
tests_success += 1
except subprocess.CalledProcessError as e:
rv = e.output
diff --git a/tests/test-generators.py b/tests/test-generators.py
index 6161d09..191db28 100755
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -93,6 +93,8 @@ def run_tests(args):
tests_run = 0
yml = yaml.safe_load(open(args.load, 'r'))
generator_names = generators.generator_names() if hasattr(generators, 'generator_names') else ['full', 'medium', 'cluster', 'legacy']
+ if args.generators:
+ generator_names = args.generators
mboxfiles = []
for file, run in yml['generators'].items():
mboxfiles.append(file)