Rev 187: Merged test fixes. in http://bzr.daniel-watkins.co.uk/pqm/ui

Daniel Watkins daniel at daniel-watkins.co.uk
Thu Jul 10 08:21:42 BST 2008


At http://bzr.daniel-watkins.co.uk/pqm/ui

------------------------------------------------------------
revno: 187
revision-id: daniel at daniel-watkins.co.uk-20080710072029-ihucmm47fklq3qpk
parent: daniel at daniel-watkins.co.uk-20080709163001-3cctj8vtzuk2ulap
parent: d.m.watkins at warwick.ac.uk-20080702013313-tpow1un410t1ihlr
committer: Daniel Watkins <daniel at daniel-watkins.co.uk>
branch nick: ui
timestamp: Thu 2008-07-10 08:20:29 +0100
message:
  Merged test fixes.
modified:
  pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
    ------------------------------------------------------------
    revno: 174.1.5
    revision-id: d.m.watkins at warwick.ac.uk-20080702013313-tpow1un410t1ihlr
    parent: d.m.watkins at warwick.ac.uk-20080702012242-2og2jtojx67inb2q
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: fix-tests
    timestamp: Wed 2008-07-02 02:33:13 +0100
    message:
      Converted pqm.tests.test_pqm.BzrHandlerTestCase to subclass bzrlib.tests.TestCaseWithTransport rather than Trial's unittest.TestCase.
    modified:
      pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
    ------------------------------------------------------------
    revno: 174.1.4
    revision-id: d.m.watkins at warwick.ac.uk-20080702012242-2og2jtojx67inb2q
    parent: d.m.watkins at warwick.ac.uk-20080701235937-wqc71id2w3islxx4
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: fix-tests
    timestamp: Wed 2008-07-02 02:22:42 +0100
    message:
      Import cleanup in pqm.tests.test_pqm.
    modified:
      pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
    ------------------------------------------------------------
    revno: 174.1.3
    revision-id: d.m.watkins at warwick.ac.uk-20080701235937-wqc71id2w3islxx4
    parent: d.m.watkins at warwick.ac.uk-20080701234226-9zdcg9718lu6r2xz
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: fix-tests
    timestamp: Wed 2008-07-02 00:59:37 +0100
    message:
      pqm.tests.test_pqm.BzrHandlerTestCase now sets up and tears down a tree-ful shared repo, to avoid tests failing when run beneath a no-trees shared repo.
    modified:
      pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
    ------------------------------------------------------------
    revno: 174.1.2
    revision-id: d.m.watkins at warwick.ac.uk-20080701234226-9zdcg9718lu6r2xz
    parent: d.m.watkins at warwick.ac.uk-20080701234154-aecrgo0ng1095fr6
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: fix-tests
    timestamp: Wed 2008-07-02 00:42:26 +0100
    message:
      Updated pqm.tests.test_pqm.BzrHandlerTestCase to take into account deprecations in bzrlib.
    modified:
      pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
    ------------------------------------------------------------
    revno: 174.1.1
    revision-id: d.m.watkins at warwick.ac.uk-20080701234154-aecrgo0ng1095fr6
    parent: robertc at robertcollins.net-20080415014518-qugji1mpm5g11gir
    committer: Daniel Watkins <D.M.Watkins at warwick.ac.uk>
    branch nick: fix-tests
    timestamp: Wed 2008-07-02 00:41:54 +0100
    message:
      Updated pqm.tests.test_pqm.FunctionalTestCommandRunner to take into account deprecations in bzrlib.
    modified:
      pqm/tests/test_pqm.py          x_Robert_Collins_<robert.collins at canonical.com>_Thu_Aug__4_22:52:41_2005_804.0
-------------- next part --------------
=== modified file 'pqm/tests/test_pqm.py'
--- a/pqm/tests/test_pqm.py	2007-05-21 01:08:46 +0000
+++ b/pqm/tests/test_pqm.py	2008-07-02 01:33:13 +0000
@@ -1,11 +1,12 @@
-
-from twisted.trial import unittest
-import config_manager
+import logging
 import os
-import logging
 import shutil
 from StringIO import StringIO
 
+from bzrlib.tests import TestCaseWithTransport
+import config_manager
+from twisted.trial import unittest
+
 import pqm
 
 sample_message = ("From: John.Citizen at example.com\n"
@@ -392,12 +393,11 @@
 class FunctionalTestCommandRunner(unittest.TestCase):
 
     def setUp(self):
-        from bzrlib.add import smart_add_tree
         from bzrlib.bzrdir import BzrDir
         from bzrlib.plugin import load_plugins
         load_plugins()
         tree = BzrDir.create_standalone_workingtree("bzrbranch")
-        smart_add_tree(tree, ["bzrbranch"])
+        tree.smart_add(["bzrbranch"])
         tree.commit("start branch.", verbose=False)
 
     def tearDown(self):
@@ -445,23 +445,21 @@
         self.failUnless(isinstance(runner.get_vcs(), pqm.Bazaar2Handler))
 
 
-class BzrHandlerTestCase(unittest.TestCase):
+class BzrHandlerTestCase(TestCaseWithTransport):
 
     def setUp(self):
-        from bzrlib.add import smart_add_tree
+        super(BzrHandlerTestCase, self).setUp()
         from bzrlib.bzrdir import BzrDir
         from bzrlib.plugin import load_plugins
         load_plugins()
-        tree = BzrDir.create_standalone_workingtree("bzrbranch")
-        smart_add_tree(tree, ["bzrbranch"])
+        tree = self.make_branch_and_tree("bzrbranch")
+        tree.smart_add(["bzrbranch"])
         tree.commit("start branch.", verbose=False)
         tree.branch.bzrdir.sprout("bzrbranch-parent")
         tree.branch.bzrdir.sprout("bzrbranch-public")
         tree.branch.bzrdir.sprout("branch-contributor")
         contrib_tree = BzrDir.open("branch-contributor").open_workingtree()
-        file = open("branch-contributor/README", "wt")
-        file.write("Boo!\n")
-        file.close()
+        self.build_tree_contents([("branch-contributor/README", "Boo!\n")])
         contrib_tree.add(["README"])
         contrib_tree.commit("add README")
 



More information about the bazaar-commits mailing list