Changeset b0695c6 in mod_gnutls


Ignore:
Timestamp:
Apr 7, 2020, 2:44:48 PM (3 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
master, proxy-ticket
Children:
0484b31
Parents:
1a85a3d
Message:

Pass parsed YAML config to mgstest.tests.run_test_conf

Parsing the config in runtest.py has the advantage that the parsed
config is available there, too, e.g. to be read by hooks.

Location:
test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • test/https-test-client.py

    r1a85a3d rb0695c6  
    1818import contextlib
    1919import os
     20import yaml
    2021
    2122from mgstest.tests import run_test_conf
     
    5253
    5354    with contextlib.closing(args.test_config):
    54         run_test_conf(args.test_config, args.timeout)
     55        test_conf = yaml.load(args.test_config, Loader=yaml.Loader)
     56        run_test_conf(test_conf, args.timeout)
  • test/mgstest/tests.py

    r1a85a3d rb0695c6  
    545545    """Load and run a test configuration.
    546546
    547     The test_conf parameter must be a YAML file, defining one or more
    548     TestConnections, to be run in order. The other three parameters
    549     are forwarded to TestConnection.run().
     547    The test_conf parameter must either a single TestConnection
     548    object, or a list of such objects to be run in order. The other
     549    three parameters are forwarded to TestConnection.run().
    550550
    551551    """
    552552    conns = None
    553553
    554     config = yaml.load(test_config, Loader=yaml.Loader)
    555     if type(config) is TestConnection:
    556         conns = [config]
    557     elif type(config) is list:
     554    if type(test_config) is TestConnection:
     555        conns = [test_config]
     556    elif type(test_config) is list:
    558557        # assume list elements are connections
    559         conns = config
     558        conns = test_config
    560559    else:
    561         raise TypeError(f'Unsupported configuration: {config!r}')
     560        raise TypeError(f'Unsupported configuration: {test_config!r}')
    562561    sys.stdout.flush()
    563562
  • test/runtest.py

    r1a85a3d rb0695c6  
    2222import sys
    2323import tempfile
     24import yaml
    2425from unittest import SkipTest
    2526
     
    100101    os.environ['TEST_NAME'] = testname
    101102
     103    # Load test config
     104    try:
     105        with open(os.path.join(testdir, 'test.yml'), 'r') as conf_file:
     106            test_conf = yaml.load(conf_file, Loader=yaml.Loader)
     107    except FileNotFoundError:
     108        test_conf = None
     109
    102110    # Load test case hooks (if any)
    103111    plugin_path = os.path.join(testdir, 'hooks.py')
     
    194202                                  response_log=args.log_responses)
    195203        else:
    196             with open(os.path.join(testdir, 'test.yml'), 'r') as test_conf:
    197                 run_test_conf(test_conf,
    198                               float(os.environ.get('TEST_QUERY_TIMEOUT', 5.0)),
    199                               conn_log=args.log_connection,
    200                               response_log=args.log_responses)
     204            run_test_conf(test_conf,
     205                          float(os.environ.get('TEST_QUERY_TIMEOUT', 5.0)),
     206                          conn_log=args.log_connection,
     207                          response_log=args.log_responses)
    201208
    202209    # run extra checks the test's hooks.py might define
Note: See TracChangeset for help on using the changeset viewer.