Coverage for testlibs / testutils.py: 100%
16 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-05 11:04 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-05 11:04 +0000
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3"""
4:Purpose: This module provides shared utilities, which are dedicated
5 to unit testing.
7:Platform: Linux/Windows | Python 3.6
8:Developer: J Berendt
9:Email: development@s3dev.uk
11:Comments: n/a
13:Example:
14 Example code use::
16 >>> from testlibs.testutils import testutils
18"""
20from time import sleep
23class _TestUtilities:
24 """Shared utilities used exclusively for unit testing."""
26 def __init__(self):
27 """Unit testing utilities class initialiser."""
28 self._msgs = self._Messages()
30 @property
31 def msgs(self):
32 """Messages class accessor."""
33 return self._msgs
36 class _Messages:
37 """General testing messages utility class."""
39 @staticmethod
40 def startoftest(msg):
41 """Print a start of testing message.
43 Args:
44 msg (str): Short description for this section of tests.
46 """
47 n = 70
48 print('\n\n', '-' * n, sep='')
49 print(f'*** Starting test for: {msg} ***'.center(n))
50 print('-' * n, '\n', sep='')
51 sleep(0.25)
54testutils = _TestUtilities()