Changeset c96a965 in mod_gnutls for test/mgstest/tests.py


Ignore:
Timestamp:
Dec 12, 2019, 6:48:09 AM (12 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
c7f83a3
Parents:
b57d2c2
Message:

Create function to run a test config YAML file

This is much more efficient when also managing the test environment
using Python.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/tests.py

    rb57d2c2 rc96a965  
    367367    t = Template(text)
    368368    return t.substitute(os.environ)
     369
     370
     371
     372def run_test_conf(test_config, timeout=5.0):
     373    conns = None
     374
     375    config = yaml.load(test_config, Loader=yaml.Loader)
     376    if type(config) is TestConnection:
     377        conns = [config]
     378    elif type(config) is list:
     379        # assume list elements are connections
     380        conns = config
     381    else:
     382        raise TypeError(f'Unsupported configuration: {config!r}')
     383    print(conns)
     384    sys.stdout.flush()
     385
     386    for i, test_conn in enumerate(conns):
     387        if test_conn.description:
     388            print(f'Running test connection {i}: {test_conn.description}')
     389            sys.stdout.flush()
     390        test_conn.run(timeout=timeout)
Note: See TracChangeset for help on using the changeset viewer.