Patchwork D6677: module-policy: update rust extension import to use the new module policy

login
register
mail settings
Submitter phabricator
Date July 31, 2019, 11:46 p.m.
Message ID <b2707ceda6580201b915f8f270c3f039@localhost.localdomain>
Download mbox | patch
Permalink /patch/41103/
State Not Applicable
Headers show

Comments

phabricator - July 31, 2019, 11:46 p.m.
Closed by commit rHGa7f1a0b3f461: module-policy: update rust extension import to use the new module policy (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6677?vs=16009&id=16099

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

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

AFFECTED FILES
  tests/test-rust-discovery.py

CHANGE DETAILS




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

Patch

diff --git a/tests/test-rust-discovery.py b/tests/test-rust-discovery.py
--- a/tests/test-rust-discovery.py
+++ b/tests/test-rust-discovery.py
@@ -1,16 +1,9 @@ 
 from __future__ import absolute_import
 import unittest
 
-try:
-    from mercurial import rustext
-    rustext.__name__  # trigger immediate actual import
-except ImportError:
-    rustext = None
-else:
-    # this would fail already without appropriate ancestor.__package__
-    from mercurial.rustext.discovery import (
-        PartialDiscovery,
-    )
+from mercurial import policy
+
+PartialDiscovery = policy.importrust('discovery', member='PartialDiscovery')
 
 try:
     from mercurial.cext import parsers as cparsers
@@ -39,7 +32,7 @@ 
     )
 
 
-@unittest.skipIf(rustext is None or cparsers is None,
+@unittest.skipIf(PartialDiscovery is None or cparsers is None,
                  "rustext or the C Extension parsers module "
                  "discovery relies on is not available")
 class rustdiscoverytest(unittest.TestCase):