Coverage for testlibs / testutils.py: 100%

16 statements  

« 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. 

6 

7:Platform: Linux/Windows | Python 3.6 

8:Developer: J Berendt 

9:Email: development@s3dev.uk 

10 

11:Comments: n/a 

12 

13:Example: 

14 Example code use:: 

15 

16 >>> from testlibs.testutils import testutils 

17 

18""" 

19 

20from time import sleep 

21 

22 

23class _TestUtilities: 

24 """Shared utilities used exclusively for unit testing.""" 

25 

26 def __init__(self): 

27 """Unit testing utilities class initialiser.""" 

28 self._msgs = self._Messages() 

29 

30 @property 

31 def msgs(self): 

32 """Messages class accessor.""" 

33 return self._msgs 

34 

35 

36 class _Messages: 

37 """General testing messages utility class.""" 

38 

39 @staticmethod 

40 def startoftest(msg): 

41 """Print a start of testing message. 

42 

43 Args: 

44 msg (str): Short description for this section of tests. 

45 

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) 

52 

53 

54testutils = _TestUtilities()