# HG changeset patch # User Alexis S. L. Carvalho # Date 1194646895 7200 # Node ID cc3af86ab6fec45a27fa61e26bdee484921351e3 # Parent b688d264a294bd1f4ee472c1cedbdc4449c6a159 test-convert-darcs: skip if we can't find the elementtree module This patch is a bit dirty to avoid having to repeat the dance required to import elementtree. diff -r b688d264a294 -r cc3af86ab6fe hgext/convert/darcs.py --- a/hgext/convert/darcs.py Fri Nov 09 20:21:35 2007 -0200 +++ b/hgext/convert/darcs.py Fri Nov 09 20:21:35 2007 -0200 @@ -21,12 +21,17 @@ def __init__(self, ui, path, rev=None): super(darcs_source, self).__init__(ui, path, rev=rev) - if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): + # check for _darcs, ElementTree, _darcs/inventory so that we can + # easily skip test-convert-darcs if ElementTree is not around + if not os.path.exists(os.path.join(path, '_darcs')): raise NoRepo("couldn't open darcs repo %s" % path) if ElementTree is None: raise util.Abort(_("Python ElementTree module is not available")) + if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): + raise NoRepo("couldn't open darcs repo %s" % path) + self.path = os.path.realpath(path) self.lastrev = None diff -r b688d264a294 -r cc3af86ab6fe tests/test-convert-darcs --- a/tests/test-convert-darcs Fri Nov 09 20:21:35 2007 -0200 +++ b/tests/test-convert-darcs Fri Nov 09 20:21:35 2007 -0200 @@ -9,6 +9,14 @@ DARCS_EMAIL='test@example.org'; export DARCS_EMAIL HOME=do_not_use_HOME_darcs; export HOME +# skip if we can't import elementtree +mkdir dummy +mkdir dummy/_darcs +if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then + echo 'hghave: missing feature: elementtree module' + exit 80 +fi + echo % initialize darcs repo mkdir darcs-repo cd darcs-repo