root/run_tests.py

Revision 131, 2.2 kB (checked in by David Rousselie <dax@happycoders.org>, 1 year ago)

Add code coverage report

Line 
1 # -*- coding: utf-8 -*-
2 ##
3 ## run_tests.py
4 ## Login : David Rousselie <dax@happycoders.org>
5 ## Started on  Wed Aug  9 21:37:35 2006 David Rousselie
6 ## $Id$
7 ##
8 ## Copyright (C) 2006 David Rousselie
9 ## This program is free software; you can redistribute it and/or modify
10 ## it under the terms of the GNU General Public License as published by
11 ## the Free Software Foundation; either version 2 of the License, or
12 ## (at your option) any later version.
13 ##
14 ## This program is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ## GNU General Public License for more details.
18 ##
19 ## You should have received a copy of the GNU General Public License
20 ## along with this program; if not, write to the Free Software
21 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 ##
23
24 import coverage
25 coverage.erase()
26 coverage.start()
27
28 import logging
29 import unittest
30 from test import test_support
31
32 import sys
33 sys.path.append("src")
34 reload(sys)
35 sys.setdefaultencoding('utf8')
36 del sys.setdefaultencoding
37
38 import jmc
39 import jmc.jabber
40 import jmc.jabber.component
41
42 import jmc.tests
43
44 def suite():
45     return jmc.tests.suite()
46
47 if __name__ == '__main__':
48     class MyTestProgram(unittest.TestProgram):
49         def runTests(self):
50             """run tests but do not exit after"""
51             if self.testRunner is None:
52                 self.testRunner = unittest.TextTestRunner(verbosity=self.verbosity)
53             self.testRunner.run(self.test)
54
55     logger = logging.getLogger()
56     logger.addHandler(logging.StreamHandler())
57     logger.setLevel(logging.CRITICAL)
58
59     MyTestProgram(defaultTest='suite')
60
61 coverage.report(["src/jmc/__init__.py",
62                  "src/jmc/lang.py",
63                  "src/jmc/runner.py",
64                  "src/jmc/jabber/__init__.py",
65                  "src/jmc/jabber/command.py",
66                  "src/jmc/jabber/component.py",
67                  "src/jmc/jabber/disco.py",
68                  "src/jmc/jabber/message.py",
69                  "src/jmc/jabber/presence.py",
70                  "src/jmc/jabber/presence.py",
71                  "src/jmc/model/__init__.py",
72                  "src/jmc/model/account.py"])
Note: See TracBrowser for help on using the browser.