module-policy: update rust extension import to use the new module policy
Differential Revision: https://phab.mercurial-scm.org/D6677
--- 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):