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