changeset 577:daf3e44a4aa9

tests: add check for dulwich in test-url-parsing.py Previously, if dulwich wasn't available, this test would fail with a traceback (example included below). This changeset makes it so that the test will be skipped with an informative message if dulwich isn't available. Traceback (most recent call last): File "/Users/carrd/hg-repos/hg-git-queue/tests/test-url-parsing.py", line 6, in <module> from hggit.git_handler import GitHandler File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/__init__.py", line 42, in <module> import gitrepo, hgrepo File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/gitrepo.py", line 13, in <module> from git_handler import GitHandler File "/Users/carrd/hg-repos/hg-git-queue/tests/../hggit/git_handler.py", line 4, in <module> from dulwich.errors import HangupException, GitProtocolError, UpdateRefsError ImportError: No module named dulwich.errors
author David M. Carr <david@carrclan.us>
date Tue, 30 Oct 2012 23:16:07 -0400
parents c4849b2dab87
children 935c4fb1bbfc
files tests/test-url-parsing.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-url-parsing.py
+++ b/tests/test-url-parsing.py
@@ -1,4 +1,12 @@
-import os, sys, tempfile, unittest, shutil
+import sys
+
+try:
+    import dulwich
+except ImportError:
+    print "skipped: missing feature: dulwich"
+    sys.exit(80)
+
+import os, tempfile, unittest, shutil
 from mercurial import ui, hg, commands
 
 sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))