Debian Codegraph @

test/test.py

raw
1 # -*- coding: utf-8 -*-
2 """Run all tests, including unit tests and regression tests"""
3
4 # Copyright (C) 2007 Anders Logg
5 #
6 # This file is part of FFC.
7 #
8 # FFC is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # FFC is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Lesser General Public License for more details.
17 #
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with FFC. If not, see <http://www.gnu.org/licenses/>.
20 #
21 # First added: 2007-06-09
22 # Last changed: 2014-05-15
23
24 import os, re, sys
25
26 # Name of log file
27 pwd = os.path.dirname(os.path.abspath(__file__))
28 logfile = os.path.join(pwd, "test.log")
29 os.system("rm -f %s" % logfile)
30
31 # Tests to run
32 tests = ["unit", "regression"]
33
34 # Run tests
35 failed = []
36 for test in tests:
37 print("Running tests: %s" % test)
38 print("----------------------------------------------------------------------")
39 os.chdir(os.path.join(pwd, test))
40 #failure = os.system(sys.executable + " test.py | tee -a %s" % logfile)
41 failure = os.system(sys.executable + " test.py")
42 if failure:
43 print("Test FAILED")
44 failed.append(test)
45 print("")
46
47 print("To view the test log, use the following command: less -R test.log")
48
49 sys.exit(len(failed))