Changeset 0f52d48 in mod_gnutls for test/mgstest/__init__.py


Ignore:
Timestamp:
Jan 8, 2020, 5:06:31 PM (12 months ago)
Author:
Fiona Klute <fiona.klute@…>
Branches:
asyncio, master, proxy-ticket
Children:
482bafc
Parents:
baa0056
Message:

Switch most tests to hooks.py instead of preconditions in test scripts

The new function mgstest.require_apache_modules() covers required
Apache modules, the rest is individual stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/mgstest/__init__.py

    rbaa0056 r0f52d48  
    1818
    1919import fcntl
     20import os
     21import os.path
    2022import sys
    2123
    2224from contextlib import contextmanager
     25from unittest import SkipTest
    2326
    2427class TestExpectationFailed(Exception):
     
    8891    else:
    8992        raise TestExpectationFailed(f'No match found for {regexp.pattern}!')
     93
     94
     95
     96def require_apache_modules(*modules):
     97    """Raise unittest.SkipTest if any of the given module files (full file
     98    name) is not present in AP_LIBEXECDIR.
     99
     100    """
     101    mod_dir = os.environ['AP_LIBEXECDIR']
     102    for mod in modules:
     103        if not os.path.isfile(os.path.join(mod_dir, mod)):
     104            raise SkipTest(f'{mod} not found, skipping.')
Note: See TracChangeset for help on using the changeset viewer.