-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathtest.py
73 lines (59 loc) · 2.08 KB
/
test.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'''
test.py - Run all ColorPy test cases.
Functions:
test() -
Run all the test cases.
License:
Copyright (C) 2008 Mark Kness
Author - Mark Kness - [email protected]
This file is part of ColorPy.
ColorPy is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
ColorPy is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with ColorPy. If not, see <http://www.gnu.org/licenses/>.
'''
from __future__ import print_function
import unittest
import test_colormodels
import test_ciexyz
import test_illuminants
import test_blackbody
import test_rayleigh
import test_thinfilm
def test ():
# no test cases for plots/misc - but figures.py will exercise those.
# Explicitly run the unittest cases in the modules.
# This is perhaps a bit clumsy.
# A more conventional way to run all of the tests, is at the command line:
# python -m unittest discover
modules = [
test_blackbody,
test_ciexyz,
test_colormodels,
test_illuminants,
test_rayleigh,
test_thinfilm,
]
for module in modules:
result = unittest.TestResult()
loader = unittest.TestLoader()
suite = loader.loadTestsFromModule(module)
suite.run(result)
# Print results.
msg = 'Module: %s Errors: %s Failures: %s' % (
module.__name__, result.errors, result.failures)
print (msg)
print (str(result))
# Raise an exception if there were problems.
ok = (len(result.errors) == 0) and (len(result.failures) == 0)
if not ok:
# Perhaps not the right exception type...
raise ValueError(msg)
if __name__ == '__main__':
test()