Add code coverage report
darcs-hash:20071212181010-86b55-7b831a663f431b209c9067947579cbe4c50e42a8.gz
This commit is contained in:
45
run_tests.py
45
run_tests.py
@@ -4,24 +4,27 @@
|
|||||||
## Login : David Rousselie <dax@happycoders.org>
|
## Login : David Rousselie <dax@happycoders.org>
|
||||||
## Started on Wed Aug 9 21:37:35 2006 David Rousselie
|
## Started on Wed Aug 9 21:37:35 2006 David Rousselie
|
||||||
## $Id$
|
## $Id$
|
||||||
##
|
##
|
||||||
## Copyright (C) 2006 David Rousselie
|
## Copyright (C) 2006 David Rousselie
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## 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
|
## it under the terms of the GNU General Public License as published by
|
||||||
## the Free Software Foundation; either version 2 of the License, or
|
## the Free Software Foundation; either version 2 of the License, or
|
||||||
## (at your option) any later version.
|
## (at your option) any later version.
|
||||||
##
|
##
|
||||||
## This program is distributed in the hope that it will be useful,
|
## This program is distributed in the hope that it will be useful,
|
||||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
## GNU General Public License for more details.
|
## GNU General Public License for more details.
|
||||||
##
|
##
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##
|
##
|
||||||
|
|
||||||
import coverage
|
import coverage
|
||||||
|
coverage.erase()
|
||||||
|
coverage.start()
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test import test_support
|
||||||
@@ -36,26 +39,34 @@ import jmc
|
|||||||
import jmc.jabber
|
import jmc.jabber
|
||||||
import jmc.jabber.component
|
import jmc.jabber.component
|
||||||
|
|
||||||
import jmc.tests as jmc
|
import jmc.tests
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
return jmc.suite()
|
return jmc.tests.suite()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
class MyTestProgram(unittest.TestProgram):
|
||||||
|
def runTests(self):
|
||||||
|
"""run tests but do not exit after"""
|
||||||
|
if self.testRunner is None:
|
||||||
|
self.testRunner = unittest.TextTestRunner(verbosity=self.verbosity)
|
||||||
|
self.testRunner.run(self.test)
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.addHandler(logging.StreamHandler())
|
logger.addHandler(logging.StreamHandler())
|
||||||
logger.setLevel(logging.CRITICAL)
|
logger.setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
coverage.erase()
|
|
||||||
coverage.start()
|
|
||||||
|
|
||||||
unittest.main(defaultTest='suite')
|
MyTestProgram(defaultTest='suite')
|
||||||
|
|
||||||
coverage.stop()
|
coverage.report(["src/jmc/__init__.py",
|
||||||
coverage.analysis(jmc.jabber.component)
|
"src/jmc/lang.py",
|
||||||
coverage.analysis(jmc.lang)
|
"src/jmc/runner.py",
|
||||||
coverage.analysis(jmc.model.account)
|
"src/jmc/jabber/__init__.py",
|
||||||
|
"src/jmc/jabber/command.py",
|
||||||
coverage.report([jmc.jabber.component, \
|
"src/jmc/jabber/component.py",
|
||||||
jmc.lang, \
|
"src/jmc/jabber/disco.py",
|
||||||
jmc.model.account])
|
"src/jmc/jabber/message.py",
|
||||||
|
"src/jmc/jabber/presence.py",
|
||||||
|
"src/jmc/jabber/presence.py",
|
||||||
|
"src/jmc/model/__init__.py",
|
||||||
|
"src/jmc/model/account.py"])
|
||||||
|
|||||||
7
setup.py
7
setup.py
@@ -21,6 +21,13 @@
|
|||||||
##
|
##
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
from distutils import sysconfig
|
||||||
|
|
||||||
|
prefix = sysconfig.get_config_vars("prefix")
|
||||||
|
if len(prefix) == 0 or prefix[0] == "/usr":
|
||||||
|
config_dir = "/etc/jabber"
|
||||||
|
else:
|
||||||
|
config_dir = prefix[0] + "/etc/jabber"
|
||||||
|
|
||||||
setup(name='jmc',
|
setup(name='jmc',
|
||||||
version='0.3',
|
version='0.3',
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
##
|
|
||||||
## config.py
|
|
||||||
## Login : David Rousselie <dax@happycoders.org>
|
|
||||||
## Started on Fri Jan 7 11:06:42 2005
|
|
||||||
## $Id: config.py,v 1.2 2005/03/13 11:39:36 dax Exp $
|
|
||||||
##
|
|
||||||
## Copyright (C) 2005
|
|
||||||
## 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 2 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, write to the Free Software
|
|
||||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
##
|
|
||||||
|
|
||||||
import libxml2
|
|
||||||
import os
|
|
||||||
|
|
||||||
from pyxmpp.jid import JID
|
|
||||||
from jmc.jabber.component import ComponentFatalError
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
def __init__(self, config_file):
|
|
||||||
self.doc = None
|
|
||||||
self.config_file = config_file
|
|
||||||
# libxml2.initializeCatalog()
|
|
||||||
# libxml2.loadCatalog(os.path.join(data_dir, "catalog.xml"))
|
|
||||||
parser = libxml2.createFileParserCtxt(config_file)
|
|
||||||
# parser.validate(1)
|
|
||||||
parser.parseDocument()
|
|
||||||
if not parser.isValid():
|
|
||||||
raise ComponentFatalError, "Invalid configuration"
|
|
||||||
self.doc = parser.doc()
|
|
||||||
|
|
||||||
def get_content(self, xpath):
|
|
||||||
return self.doc.xpathEval(xpath)[0].getContent()
|
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
if self.doc:
|
|
||||||
self.doc.freeDoc()
|
|
||||||
@@ -3,15 +3,16 @@ __revision__ = ""
|
|||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from jmc.jabber.tests import component, disco, command, message
|
from jmc.jabber.tests import component, disco, command, message, presence
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = unittest.TestSuite()
|
test_suite = unittest.TestSuite()
|
||||||
suite.addTest(component.suite())
|
test_suite.addTest(component.suite())
|
||||||
suite.addTest(disco.suite())
|
test_suite.addTest(disco.suite())
|
||||||
suite.addTest(command.suite())
|
test_suite.addTest(command.suite())
|
||||||
suite.addTest(message.suite())
|
test_suite.addTest(message.suite())
|
||||||
return suite
|
test_suite.addTest(presence.suite())
|
||||||
|
return test_suite
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(defaultTest='suite')
|
unittest.main(defaultTest='suite')
|
||||||
|
|||||||
@@ -244,10 +244,10 @@ class RootSendMailMessageHandler_TestCase(JCLTestCase):
|
|||||||
u"Cc": "cc@test.com"})
|
u"Cc": "cc@test.com"})
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = unittest.TestSuite()
|
test_suite = unittest.TestSuite()
|
||||||
suite.addTest(unittest.makeSuite(SendMailMessageHandler_TestCase, 'test'))
|
test_suite.addTest(unittest.makeSuite(SendMailMessageHandler_TestCase, 'test'))
|
||||||
suite.addTest(unittest.makeSuite(RootSendMailMessageHandler_TestCase, 'test'))
|
test_suite.addTest(unittest.makeSuite(RootSendMailMessageHandler_TestCase, 'test'))
|
||||||
return suite
|
return test_suite
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(defaultTest='suite')
|
unittest.main(defaultTest='suite')
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ from jmc.jabber import tests as jabber
|
|||||||
from jmc.model import tests as model
|
from jmc.model import tests as model
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
suite = unittest.TestSuite()
|
test_suite = unittest.TestSuite()
|
||||||
suite.addTest(lang.suite())
|
test_suite.addTest(lang.suite())
|
||||||
suite.addTest(runner.suite())
|
test_suite.addTest(runner.suite())
|
||||||
suite.addTest(jabber.suite())
|
test_suite.addTest(jabber.suite())
|
||||||
suite.addTest(model.suite())
|
test_suite.addTest(model.suite())
|
||||||
return suite
|
return test_suite
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main(defaultTest='suite')
|
unittest.main(defaultTest='suite')
|
||||||
|
|||||||
Reference in New Issue
Block a user