tests/test-rust-discovery.py
changeset 42670 a7f1a0b3f461
parent 42180 1b0be75cb61f
child 42735 5154701a5413
--- a/tests/test-rust-discovery.py	Sun Jul 21 07:59:16 2019 -0700
+++ b/tests/test-rust-discovery.py	Tue Jul 23 11:12:36 2019 +0200
@@ -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):