File: unittestrunner.py

package info (click to toggle)
pcbasic 2.0.7-8
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 35,416 kB
  • sloc: python: 28,411; sh: 103; makefile: 10
file content (28 lines) | stat: -rw-r--r-- 700 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
PC-BASIC tests.unit
unit tests

(c) 2015--2023 Rob Hagemans
This file is released under the GNU GPL version 3 or later.
"""

import os
import sys

# make pcbasic package accessible
HERE = os.path.dirname(os.path.abspath(__file__))
sys.path = [os.path.join(HERE, '..', '..')] + sys.path


# unittest verbosity, increase for more info on what is running
VERBOSITY = 1


def run_unit_tests():
    import pcbasic
    sys.stderr.write('Running unit tests: ')
    with pcbasic.compat.stdio.quiet('stdout'):
        import unittest
        suite = unittest.loader.defaultTestLoader.discover(HERE, 'test*.py', None)
        runner = unittest.TextTestRunner(verbosity=VERBOSITY)
        runner.run(suite)