Changeset 9a48691 in mod_gnutls


Ignore:
Timestamp:
Jan 8, 2020, 3:32:30 PM (11 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, master, proxy-ticket
Children:
baa0056
Parents:
dda0f4a
Message:

Test suite: Support checking preconditions in prepare_env hook

The hook may now raise unittest.SkipTest? to skip the test case if any
preconditions (e.g. availability of a certain Apache module) are not
met.

Location:
test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/hooks.py

    rdda0f4a r9a48691  
    2121    prepare_env:
    2222
    23         This hook runs before the test services are started. It can
    24         set any additional environment variables the test might need.
     23        This hook runs before the test services are started. It serves
     24        two purposes:
     25
     26        1. Check special precondition the test might need
     27        (e.g. availability of a certain Apache module), and raise
     28        unittest.SkipTest to skip the test case if they are not met.
     29
     30        2. Set any additional environment variables the test might
     31        need.
    2532
    2633    run_connection:
  • test/runtest.py

    rdda0f4a r9a48691  
    2222import sys
    2323import tempfile
     24from unittest import SkipTest
    2425
    2526import mgstest.hooks
     
    131132
    132133    # This hook may modify the environment as needed for the test.
    133     if plugin.prepare_env:
    134         plugin.prepare_env()
     134    try:
     135        if plugin.prepare_env:
     136            plugin.prepare_env()
     137    except SkipTest as skip:
     138        print(f'Skipping: {skip!s}')
     139        sys.exit(77)
    135140
    136141    # If VERBOSE is enabled, log the HTTPD build configuration
Note: See TracChangeset for help on using the changeset viewer.