Mercurial > hg
changeset 42670:a7f1a0b3f461
module-policy: update rust extension import to use the new module policy
Differential Revision: https://phab.mercurial-scm.org/D6677
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 23 Jul 2019 11:12:36 +0200 |
parents | 36c692eb28d3 |
children | e77be7e2109f |
files | tests/test-rust-discovery.py |
diffstat | 1 files changed, 4 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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):