Commits

David Carr  committed daf3e44

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

  • Participants
  • Parent commits c4849b2

Comments (0)

Files changed (1)

File tests/test-url-parsing.py

-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))