blob: 2bb863769e1d8150238396d073092217afe23fa4 (
plain)
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
29
30
31
32
33
34
|
# -*- Mode: Python -*-
import os
import glob
import sys
import unittest
# force untranslated messages, as we check for them in some tests
os.environ['LC_MESSAGES'] = 'C'
# Load tests.
if 'TEST_NAMES' in os.environ:
names = os.environ['TEST_NAMES'].split()
elif 'TEST_FILES' in os.environ:
names = []
for filename in os.environ['TEST_FILES'].split():
names.append(filename[:-3])
else:
names = []
for filename in glob.iglob("test_*.py"):
names.append(filename[:-3])
loader = unittest.TestLoader()
suite = loader.loadTestsFromNames(names)
# Run tests.
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
if not result.wasSuccessful():
sys.exit(1) # exit code so "make check" reports error
|