Rev 162: Add a very basic test suite, in preparation for adding more testing for in http://bazaar.launchpad.net/~jameinel/bzr-explorer/basic-tests
John Arbash Meinel
john at arbash-meinel.com
Tue Jul 7 20:39:55 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr-explorer/basic-tests
------------------------------------------------------------
revno: 162
revision-id: john at arbash-meinel.com-20090707193948-7aoywu7hx628yys6
parent: ian.clatworthy at canonical.com-20090702104137-jseoixkwi90eg6sb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: basic-tests
timestamp: Tue 2009-07-07 14:39:48 -0500
message:
Add a very basic test suite, in preparation for adding more testing for
other work I'll be doing.
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2009-06-30 10:55:21 +0000
+++ b/__init__.py 2009-07-07 19:39:48 +0000
@@ -29,7 +29,7 @@
lazy_import(globals(), '''
from PyQt4 import QtGui, QtCore
-from bzrlib.plugins.explorer.lib.explorer import QExplorerMainWindow
+from bzrlib.plugins.explorer.lib import explorer
''')
@@ -38,15 +38,9 @@
import bzrlib.plugins.qbzr.lib
-def test_suite():
- """Called by bzrlib to fetch tests for this plugin"""
- from unittest import TestSuite, TestLoader
- #from bzrlib.plugins.explorer.lib.tests import ...
- loader = TestLoader()
- suite = TestSuite()
- for module in []:
- suite.addTests(loader.loadTestsFromModule(module))
- return suite
+def load_tests(basic_tests, module, loader):
+ from bzrlib.plugins.explorer.tests import load_tests
+ return load_tests(basic_tests, module, loader)
class cmd_explorer(Command):
@@ -114,7 +108,7 @@
# TODO: setup exception handler ala QBzrCommand
# (inheriting directly from QBzrCommands cause a metadata error?)
app = QtGui.QApplication(sys.argv)
- window = QExplorerMainWindow(location=location, profile=hat,
+ window = explorer.QExplorerMainWindow(location=location, profile=hat,
desktop=desktop, dry_run=dry_run, preferences=prefs)
window.show()
app.exec_()
=== added directory 'tests'
=== added file 'tests/__init__.py'
--- a/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ b/tests/__init__.py 2009-07-07 19:39:48 +0000
@@ -0,0 +1,34 @@
+# Copyright (C) 2009 Canonical Ltd
+#
+# 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
+
+"""Test Suite for bzr-explorer"""
+
+from bzrlib.tests import (
+ TestCase,
+ TestCaseInTempDir,
+ TestCaseWithTransport,
+ )
+
+
+def load_tests(basic_tests, module, loader):
+ suite = loader.suiteClass()
+ suite.addTests(basic_tests)
+
+ mod_names = [__name__ + '.' + x for x in [
+ 'test_welcome_model'
+ ]]
+ suite.addTests(loader.loadTestsFromModuleNames(mod_names))
+ return suite
=== added file 'tests/test_welcome_model.py'
--- a/tests/test_welcome_model.py 1970-01-01 00:00:00 +0000
+++ b/tests/test_welcome_model.py 2009-07-07 19:39:48 +0000
@@ -0,0 +1,27 @@
+# Copyright (C) 2009 Canonical Ltd
+#
+# 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
+
+"""Tests for the WelcomeModel"""
+
+from bzrlib.plugins.explorer import tests
+from bzrlib.plugins.explorer.lib import welcome
+
+
+class TestWelcomeModel(tests.TestCaseInTempDir):
+
+ def test__init__(self):
+ model = welcome.WelcomeModel('a url', None, None, None)
+
More information about the bazaar-commits
mailing list