-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
executable file
·73 lines (57 loc) · 2.45 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
#!/usr/bin/env python
##############################################################################
# SageUI: A graphical user interface to Sage, Trac, and Git.
# Copyright (C) 2013 Volker Braun <vbraun.name@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##############################################################################
import doctest
import sys
import os
import logging
import importlib
sys.path.append(os.path.join(os.getcwd(), 'src'))
from sageui.test.doctest_parser import SageDocTestParser, SageOutputChecker
def testmod(module, globs={}):
if isinstance(module, basestring):
module = importlib.import_module(module)
parser = SageDocTestParser(long=True, optional_tags=('sage',))
finder = doctest.DocTestFinder(parser=parser)
checker = SageOutputChecker()
opts = doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
runner = doctest.DocTestRunner(checker=checker, optionflags=opts)
for test in finder.find(module):
test.globs.update(globs)
runner.run(test)
testmod('sageui.test.doctest_parser')
def test_trac_model():
testmod('sageui.model.trac_ticket')
testmod('sageui.model.trac_database')
testmod('sageui.model.trac_server')
def test_git_model():
testmod('sageui.model.git_error')
from sageui.test.test_builder import TestBuilder
test = TestBuilder()
testmod('sageui.model.git_file', globs={'test':test})
testmod('sageui.model.git_commit', globs={'test':test})
testmod('sageui.model.git_branch', globs={'test':test})
testmod('sageui.model.git_repository', globs={'test':test})
#repo = sageui.model.git_repository.GitRepository(repo_path, verbose=True)
#repo.git._user_email_set = False
#testmod('sageui.model.git_interface', globs={'git':repo.git})
def run_doctests():
test_trac_model()
test_git_model()
if __name__ == '__main__':
run_doctests()