tests: import mercurial modules by name in test-propertycache
authorYuya Nishihara <yuya@tcha.org>
Tue, 05 Apr 2016 23:30:18 +0900
changeset 28839 de7802c3a1df
parent 28838 a9a8b3f29544
child 28840 8717d4609ab3
tests: import mercurial modules by name in test-propertycache This is our convention, and silences import-checker.py that would say imports weren't lexically sorted.
tests/test-propertycache.py
--- a/tests/test-propertycache.py	Tue Apr 05 23:33:55 2016 +0900
+++ b/tests/test-propertycache.py	Tue Apr 05 23:30:18 2016 +0900
@@ -7,16 +7,18 @@
 from __future__ import absolute_import, print_function
 import os
 import subprocess
-import mercurial.localrepo
-import mercurial.util
-import mercurial.hg
-import mercurial.ui as uimod
 
+from mercurial import (
+    hg,
+    localrepo,
+    ui as uimod,
+    util,
+)
 
 # create some special property cache that trace they call
 
 calllog = []
-@mercurial.util.propertycache
+@util.propertycache
 def testcachedfoobar(repo):
     name = repo.filtername
     if name is None:
@@ -26,7 +28,7 @@
     return val
 
 unficalllog = []
-@mercurial.localrepo.unfilteredpropertycache
+@localrepo.unfilteredpropertycache
 def testcachedunfifoobar(repo):
     name = repo.filtername
     if name is None:
@@ -36,8 +38,8 @@
     return val
 
 #plug them on repo
-mercurial.localrepo.localrepository.testcachedfoobar = testcachedfoobar
-mercurial.localrepo.localrepository.testcachedunfifoobar = testcachedunfifoobar
+localrepo.localrepository.testcachedfoobar = testcachedfoobar
+localrepo.localrepository.testcachedunfifoobar = testcachedunfifoobar
 
 
 # Create an empty repo and instantiate it. It is important to run
@@ -45,7 +47,7 @@
 repopath = os.path.join(os.environ['TESTTMP'], 'repo')
 assert subprocess.call(['hg', 'init', repopath]) == 0
 ui = uimod.ui()
-repo = mercurial.hg.repository(ui, path=repopath).unfiltered()
+repo = hg.repository(ui, path=repopath).unfiltered()
 
 
 print('')