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

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Wed Jul 31 19:46:38 EDT 2019


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

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 @@
     )
 
 
- at unittest.skipIf(rustext is None or cparsers is None,
+ at 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):



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


More information about the Mercurial-devel mailing list