Rev 29: Work around test fixture limitation regarding self.outf (cough). All tests passing again. in http://code.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk
Vincent Ladeuil
v.ladeuil+lp at free.fr
Fri Apr 25 19:29:40 BST 2008
At http://code.launchpad.net/%7Ebzr-upload-devs/bzr-upload/trunk
------------------------------------------------------------
revno: 29
revision-id: v.ladeuil+lp at free.fr-20080425182934-mepc2hfjxvd7yr9n
parent: argentina at gmail.com-20080406234418-old5sgsuvo14ufif
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: upload
timestamp: Fri 2008-04-25 20:29:34 +0200
message:
Work around test fixture limitation regarding self.outf (cough). All tests passing again.
* __init__.py:
(cmd_upload.run): Temporary hack to make tests pass again.
(cmd_upload.upload_tree): Report switching to full upload and
return early once the upload is done.
(load_tests): Use load_tests instead of test_suite.
modified:
__init__.py __init__.py-20080307145942-xx1xgifrreovahgz-1
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py 2008-04-06 23:44:18 +0000
+++ b/__init__.py 2008-04-25 18:29:34 +0000
@@ -44,7 +44,6 @@
lazy_import.lazy_import(globals(), """
from bzrlib import (
branch,
- delta,
errors,
revisionspec,
transport,
@@ -79,6 +78,9 @@
def run(self, location=None, full=False, revision=None, remember=None,
directory=None, verbose=False,
):
+ # XXX: Ugly hack to make tests pass
+ if not self.__dict__.has_key('outf'):
+ self._setup_outf()
if directory is None:
directory = u'.'
@@ -242,7 +244,12 @@
try:
rev_id = self.get_uploaded_revid()
except errors.NoSuchFile:
+ if self.verbose:
+ self.outf.write('No uploaded revision id found,'
+ ' switching to full upload')
self.upload_full_tree()
+ # We're done
+ return
# XXX: errors out if rev_id not in branch history (probably someone
# uploaded from a different branch).
@@ -305,15 +312,16 @@
commands.register_command(cmd_upload)
-def test_suite():
- from bzrlib.tests import TestUtil
+def load_tests(basic_tests, module, loader):
+ result = loader.suiteClass()
+ # add the tests for this module
+ # XXX: this module should define no tests !
+ result.addTests(basic_tests)
- suite = TestUtil.TestSuite()
- loader = TestUtil.TestLoader()
testmod_names = [
'test_upload',
]
- suite.addTest(loader.loadTestsFromModuleNames(
+ result.addTest(loader.loadTestsFromModuleNames(
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
- return suite
+ return result
More information about the bazaar-commits
mailing list