Patchwork D8245: test: cleanly skip test-remotefilelog-datapack.py on policy that breaks it

login
register
mail settings
Submitter phabricator
Date March 5, 2020, 11:53 p.m.
Message ID <differential-rev-PHID-DREV-krhqqzknzbep3rxmuoll-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45529/
State Superseded
Headers show

Comments

phabricator - March 5, 2020, 11:53 p.m.
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  That tests requires the pure module to be available.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/test-remotefilelog-datapack.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-devel
phabricator - March 6, 2020, 10 a.m.
Alphare added a comment.
Alphare accepted this revision.


  This looks pretty arcane but I don't have a suggestion on how to do it better.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8245/new/

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

To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel

Patch

diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py
--- a/tests/test-remotefilelog-datapack.py
+++ b/tests/test-remotefilelog-datapack.py
@@ -17,6 +17,14 @@ 
 # Load the local remotefilelog, not the system one
 sys.path[0:0] = [os.path.join(os.path.dirname(__file__), '..')]
 from mercurial.node import nullid
+from mercurial import policy
+
+if not policy._packageprefs.get(policy.policy, (False, False))[1]:
+    if __name__ == '__main__':
+        msg = "skipped: pure module not available with module policy:"
+        print(msg, policy.policy, file=sys.stderr)
+        sys.exit(80)
+
 from mercurial import (
     pycompat,
     ui as uimod,