martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will make it easy to use availability of pygit2 as in conditions
  such as `#if pygit2` and `(pygit2 !)`. It also makes it a little
  clearer why the test case skipped (when that happens).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8267

AFFECTED FILES
  tests/hghave.py
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -1,5 +1,4 @@
-This test requires pygit2:
-  > $PYTHON -c 'import pygit2' || exit 80
+#require pygit2
 
 Setup:
   > GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -381,6 +381,17 @@
     return (int(m.group(1)), int(m.group(2)))
 
 
+@check("pygit2", "pygit2 Python library")
+def has_git():
+    try:
+        import pygit2
+
+        pygit2.Oid  # silence unused import
+        return True
+    except ImportError:
+        return False
+
+
 # https://github.com/git-lfs/lfs-test-server
 @check("lfs-test-server", "git-lfs test server")
 def has_lfsserver():



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to