-
Notifications
You must be signed in to change notification settings - Fork 4
/
runtests.py
53 lines (44 loc) · 2.37 KB
/
runtests.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
#!/usr/bin/env python
"""Run all unit tests.
This script requires the packages nose and coverage (available from PyPI, install using pip).
"""
# $Id: runtests.py 23069 2015-09-29 16:28:32Z gfiedler $
# Copyright Algebraix Data Corporation 2015 - $Date: 2015-09-29 11:28:32 -0500 (Tue, 29 Sep 2015) $
#
# This file is part of algebraixlib <http://github.com/AlgebraixData/algebraixlib>.
#
# algebraixlib is free software: you can redistribute it and/or modify it under the terms of version
# 3 of the GNU Lesser General Public License as published by the Free Software Foundation.
#
# algebraixlib 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 algebraixlib.
# If not, see <http://www.gnu.org/licenses/>.
# --------------------------------------------------------------------------------------------------
import inspect
import os.path as path
import sys
# noinspection PyPackageRequirements
import nose
# --------------------------------------------------------------------------------------------------
if __name__ == '__main__':
# Check python version
if sys.version_info < (3, 4, 3):
sys.exit("This script requires Python 3.4.3 or newer!")
filepath = inspect.getfile(inspect.currentframe())
dirpath = path.dirname(filepath)
# The print is not really necessary. It helps making sure we always know what we ran in the IDE.
print('main: {file} --where={dir}'.format(file=path.basename(filepath), dir=dirpath))
arguments = [
'-s', '--nocapture', '-v', # Don't capture stdout (show it in the console).
'--all-modules', # Run tests in all modules (so that __main__ tests run).
'--with-doctest', # Include doctests.
'--with-coverage', # Include unit test coverage.
'--cover-package=algebraixlib', # Exclude 3rd party code from unit test coverage report.
'--where=' + dirpath, # Enable invocation from an external path.
# --all-modules makes the following functions being run so we exclude them:
'--exclude=create_test_object|get_test_file_(name|path)'
]
nose.main(argv=arguments)