# HG changeset patch # User osimons # Date 1249693641 0 # Node ID a315e68e012a0ab5b74e1336d5d9db00f8d4fd66 # Parent 394c73ca1a66e261637bb7a4b351784504df7c38 0.6dev: Reorganizing gathering of unittests - more readable with regards to what goes where (master vs slave), and also avoids the non-obvious errors from #105 from missing Trac imports in tests. Thanks to pacopablo for initial patch. diff --git a/bitten/tests/__init__.py b/bitten/tests/__init__.py --- a/bitten/tests/__init__.py +++ b/bitten/tests/__init__.py @@ -9,26 +9,31 @@ # are also available at http://bitten.edgewall.org/wiki/License. import unittest -from bitten.tests import admin, master, model, queue, web_ui, notify -from bitten.slave_tests import slave, recipe -from bitten.build import tests as build -from bitten.report import tests as report -from bitten.util import tests as util -def suite(): + +def master_suite(): + from bitten.tests import admin, master, model, queue, web_ui, notify + from bitten.report import tests as report suite = unittest.TestSuite() suite.addTest(admin.suite()) suite.addTest(master.suite()) suite.addTest(model.suite()) - suite.addTest(recipe.suite()) suite.addTest(queue.suite()) - suite.addTest(slave.suite()) suite.addTest(web_ui.suite()) - suite.addTest(build.suite()) suite.addTest(report.suite()) - suite.addTest(util.suite()) suite.addTest(notify.suite()) return suite +def suite(): + suite = unittest.TestSuite() + try: + import trac + suite.addTest(master_suite()) + except ImportError: + print "\nTrac not installed -- Skipping master tests\n" + import bitten.slave_tests + suite.addTest(bitten.slave_tests.suite()) + return suite + if __name__ == '__main__': unittest.main(defaultTest='suite')