At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3932
revision-id: [email protected]
parent: [email protected]
parent: [email protected]
committer: Canonical.com Patch Queue Manager <[email protected]>
branch nick: +trunk
timestamp: Thu 2009-01-08 22:52:56 +0000
message:
  Fix test_plugins so that it doesn't cause real plugins to be loaded.
        (Andrew Bennetts)
modified:
  bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
    ------------------------------------------------------------
    revno: 3908.1.5
    revision-id: [email protected]
    parent: [email protected]
    committer: Andrew Bennetts <[email protected]>
    branch nick: no-plugins-testsuite
    timestamp: Wed 2009-01-07 21:05:28 +1100
    message:
      Remove unused import.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 3908.1.4
    revision-id: [email protected]
    parent: [email protected]
    committer: Andrew Bennetts <[email protected]>
    branch nick: no-plugins-testsuite
    timestamp: Wed 2009-01-07 21:04:43 +1100
    message:
      Fix test_plugins to restore the original value of bzrlib.plugin._loaded.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
    ------------------------------------------------------------
    revno: 3908.1.3
    revision-id: [email protected]
    parent: [email protected]
    committer: Andrew Bennetts <[email protected]>
    branch nick: no-plugins-testsuite
    timestamp: Wed 2009-01-07 20:32:28 +1100
    message:
      Don't unconditionally add --no-plugins to subprocess's args.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 3908.1.2
    revision-id: [email protected]
    parent: [email protected]
    committer: Andrew Bennetts <[email protected]>
    branch nick: no-plugins-testsuite
    timestamp: Wed 2009-01-07 20:31:48 +1100
    message:
      Remove stray print statement
    modified:
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
    ------------------------------------------------------------
    revno: 3908.1.1
    revision-id: [email protected]
    parent: [email protected]
    committer: Andrew Bennetts <[email protected]>
    branch nick: no-plugins-testsuite
    timestamp: Tue 2008-12-16 18:14:05 +1100
    message:
      Try harder to avoid loading plugins during the test suite.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/test_plugins.py   plugins.py-20050622075746-32002b55e5e943e9
=== modified file 'bzrlib/tests/test_plugins.py'
--- a/bzrlib/tests/test_plugins.py      2008-11-15 19:41:37 +0000
+++ b/bzrlib/tests/test_plugins.py      2009-01-07 10:04:43 +0000
@@ -404,7 +404,8 @@
     def split_help_commands(self):
         help = {}
         current = None
-        for line in self.run_bzr('help commands')[0].splitlines():
+        out, err = self.run_bzr('--no-plugins help commands')
+        for line in out.splitlines():
             if not line.startswith(' '):
                 current = line.split()[0]
             help[current] = help.get(current, '') + line
@@ -632,12 +633,21 @@
 
 
 def clear_plugins(test_case):
+    # Save the attributes that we're about to monkey-patch.
     old_plugins_path = bzrlib.plugins.__path__
+    old_loaded = plugin._loaded
+    old_load_from_path = plugin.load_from_path
+    # Change bzrlib.plugin to think no plugins have been loaded yet.
     bzrlib.plugins.__path__ = []
     plugin._loaded = False
+    # Monkey-patch load_from_path to stop it from actually loading anything.
+    def load_from_path(dirs):
+        pass
+    plugin.load_from_path = load_from_path
     def restore_plugins():
         bzrlib.plugins.__path__ = old_plugins_path
-        plugin._loaded = False
+        plugin._loaded = old_loaded
+        plugin.load_from_path = old_load_from_path
     test_case.addCleanup(restore_plugins)
 
 


-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to