##// END OF EJS Templates
tests: clarify demandimport disabled state
timeless -
r29981:129e38a7 default
parent child Browse files
Show More
@@ -1,70 +1,71 b''
1 1 from __future__ import print_function
2 2
3 3 from mercurial import demandimport
4 4 demandimport.enable()
5 5
6 6 import os
7 7 import subprocess
8 8 import sys
9 9
10 10 # Only run if demandimport is allowed
11 11 if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'],
12 12 'demandimport']):
13 13 sys.exit(80)
14 14
15 15 if os.name != 'nt':
16 16 try:
17 17 import distutils.msvc9compiler
18 18 print('distutils.msvc9compiler needs to be an immediate '
19 19 'importerror on non-windows platforms')
20 20 distutils.msvc9compiler
21 21 except ImportError:
22 22 pass
23 23
24 24 import re
25 25
26 26 rsub = re.sub
27 27 def f(obj):
28 28 l = repr(obj)
29 29 l = rsub("0x[0-9a-fA-F]+", "0x?", l)
30 30 l = rsub("from '.*'", "from '?'", l)
31 31 l = rsub("'<[a-z]*>'", "'<whatever>'", l)
32 32 return l
33 33
34 34 import os
35 35
36 36 print("os =", f(os))
37 37 print("os.system =", f(os.system))
38 38 print("os =", f(os))
39 39
40 40 from mercurial import util
41 41
42 42 print("util =", f(util))
43 43 print("util.system =", f(util.system))
44 44 print("util =", f(util))
45 45 print("util.system =", f(util.system))
46 46
47 47 from mercurial import hgweb
48 48 print("hgweb =", f(hgweb))
49 49 print("hgweb_mod =", f(hgweb.hgweb_mod))
50 50 print("hgweb =", f(hgweb))
51 51
52 52 import re as fred
53 53 print("fred =", f(fred))
54 54
55 55 import sys as re
56 56 print("re =", f(re))
57 57
58 58 print("fred =", f(fred))
59 59 print("fred.sub =", f(fred.sub))
60 60 print("fred =", f(fred))
61 61
62 62 print("re =", f(re))
63 63 print("re.stderr =", f(re.stderr))
64 64 print("re =", f(re))
65 65
66 66 demandimport.disable()
67 67 os.environ['HGDEMANDIMPORT'] = 'disable'
68 # this enable call should not actually enable demandimport!
68 69 demandimport.enable()
69 70 from mercurial import node
70 71 print("node =", f(node))
General Comments 0
You need to be logged in to leave comments. Login now