tests: check for bzr support by importing bzrlib
authorDirkjan Ochtman <dirkjan@ochtman.nl>
Thu, 02 Oct 2008 16:22:02 +0200
changeset 7061 8b874f8cd29f
parent 7060 972cce34f345
child 7062 efc579fdaf69
tests: check for bzr support by importing bzrlib This is better than starting bzr --version, because it works correctly when running tests with a non-default Python (version).
tests/hghave
--- a/tests/hghave	Thu Oct 02 15:48:57 2008 +0200
+++ b/tests/hghave	Thu Oct 02 16:22:02 2008 +0200
@@ -25,7 +25,11 @@
     return matchoutput('baz --version 2>&1', r'baz Bazaar version')
 
 def has_bzr():
-    return matchoutput('bzr --version 2>&1', r'Bazaar \(bzr\)')
+    try:
+        import bzrlib
+        return True
+    except ImportError:
+        return False
 
 def has_cvs():
     re = r'Concurrent Versions System.*?server'