##// END OF EJS Templates
py3: fix test-bad-extension expectations for py35...
Ian Moody -
r43461:5ed1abd0 default
parent child Browse files
Show More
@@ -1,156 +1,165 b''
1 1 $ filterlog () {
2 2 > sed -e 's!^[0-9/]* [0-9:]* ([0-9]*)>!YYYY/MM/DD HH:MM:SS (PID)>!'
3 3 > }
4 4
5 5 ensure that failing ui.atexit handlers report sensibly
6 6
7 7 $ cat > $TESTTMP/bailatexit.py <<EOF
8 8 > from mercurial import util
9 9 > def bail():
10 10 > raise RuntimeError('ui.atexit handler exception')
11 11 >
12 12 > def extsetup(ui):
13 13 > ui.atexit(bail)
14 14 > EOF
15 15 $ hg -q --config extensions.bailatexit=$TESTTMP/bailatexit.py \
16 16 > help help
17 17 hg help [-eck] [-s PLATFORM] [TOPIC]
18 18
19 19 show help for a given topic or a help overview
20 20 error in exit handlers:
21 21 Traceback (most recent call last):
22 22 File "*/mercurial/dispatch.py", line *, in _runexithandlers (glob)
23 23 func(*args, **kwargs)
24 24 File "$TESTTMP/bailatexit.py", line *, in bail (glob)
25 25 raise RuntimeError('ui.atexit handler exception')
26 26 RuntimeError: ui.atexit handler exception
27 27 [255]
28 28
29 29 $ rm $TESTTMP/bailatexit.py
30 30
31 31 another bad extension
32 32
33 33 $ echo 'raise Exception("bit bucket overflow")' > badext.py
34 34 $ abspathexc=`pwd`/badext.py
35 35
36 36 $ cat >baddocext.py <<EOF
37 37 > """
38 38 > baddocext is bad
39 39 > """
40 40 > EOF
41 41 $ abspathdoc=`pwd`/baddocext.py
42 42
43 43 $ cat <<EOF >> $HGRCPATH
44 44 > [extensions]
45 45 > gpg =
46 46 > hgext.gpg =
47 47 > badext = $abspathexc
48 48 > baddocext = $abspathdoc
49 49 > badext2 =
50 50 > EOF
51 51
52 52 $ hg -q help help 2>&1 |grep extension
53 53 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
54 54 *** failed to import extension badext2: No module named *badext2* (glob)
55 55
56 56 show traceback
57 57
58 58 $ hg -q help help --traceback 2>&1 | egrep ' extension|^Exception|Traceback|ImportError|ModuleNotFound'
59 59 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
60 60 Traceback (most recent call last):
61 61 Exception: bit bucket overflow
62 62 *** failed to import extension badext2: No module named *badext2* (glob)
63 63 Traceback (most recent call last):
64 64 ImportError: No module named badext2 (no-py3 !)
65 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
65 ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
66 ModuleNotFoundError: No module named 'hgext.badext2' (py36 !)
66 67 Traceback (most recent call last): (py3 !)
67 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
68 ImportError: No module named 'hgext3rd.badext2' (py3 no-py36 !)
69 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py36 !)
68 70 Traceback (most recent call last): (py3 !)
69 ModuleNotFoundError: No module named 'badext2' (py3 !)
71 ImportError: No module named 'badext2' (py3 no-py36 !)
72 ModuleNotFoundError: No module named 'badext2' (py36 !)
70 73
71 74 names of extensions failed to load can be accessed via extensions.notloaded()
72 75
73 76 $ cat <<EOF > showbadexts.py
74 77 > from mercurial import commands, extensions, registrar
75 78 > cmdtable = {}
76 79 > command = registrar.command(cmdtable)
77 80 > @command(b'showbadexts', norepo=True)
78 81 > def showbadexts(ui, *pats, **opts):
79 82 > ui.write(b'BADEXTS: %s\n' % b' '.join(sorted(extensions.notloaded())))
80 83 > EOF
81 84 $ hg --config extensions.badexts=showbadexts.py showbadexts 2>&1 | grep '^BADEXTS'
82 85 BADEXTS: badext badext2
83 86
84 87 #if no-extraextensions
85 88 show traceback for ImportError of hgext.name if devel.debug.extensions is set
86 89
87 90 $ (hg help help --traceback --debug --config devel.debug.extensions=yes 2>&1) \
88 91 > | grep -v '^ ' \
89 92 > | filterlog \
90 93 > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|^YYYY|not import|ModuleNotFound'
91 94 YYYY/MM/DD HH:MM:SS (PID)> loading extensions
92 95 YYYY/MM/DD HH:MM:SS (PID)> - processing 5 entries
93 96 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: gpg
94 97 YYYY/MM/DD HH:MM:SS (PID)> > gpg extension loaded in * (glob)
95 98 YYYY/MM/DD HH:MM:SS (PID)> - validating extension tables: gpg
96 99 YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: gpg
97 100 YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob)
98 101 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: badext
99 102 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
100 103 Traceback (most recent call last):
101 104 Exception: bit bucket overflow
102 105 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: baddocext
103 106 YYYY/MM/DD HH:MM:SS (PID)> > baddocext extension loaded in * (glob)
104 107 YYYY/MM/DD HH:MM:SS (PID)> - validating extension tables: baddocext
105 108 YYYY/MM/DD HH:MM:SS (PID)> - invoking registered callbacks: baddocext
106 109 YYYY/MM/DD HH:MM:SS (PID)> > callbacks completed in * (glob)
107 110 YYYY/MM/DD HH:MM:SS (PID)> - loading extension: badext2
108 111 YYYY/MM/DD HH:MM:SS (PID)> - could not import hgext.badext2 (No module named *badext2*): trying hgext3rd.badext2 (glob)
109 112 Traceback (most recent call last):
110 113 ImportError: No module named badext2 (no-py3 !)
111 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
114 ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
115 ModuleNotFoundError: No module named 'hgext.badext2' (py36 !)
112 116 YYYY/MM/DD HH:MM:SS (PID)> - could not import hgext3rd.badext2 (No module named *badext2*): trying badext2 (glob)
113 117 Traceback (most recent call last):
114 118 ImportError: No module named badext2 (no-py3 !)
115 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
119 ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
120 ModuleNotFoundError: No module named 'hgext.badext2' (py36 !)
116 121 Traceback (most recent call last): (py3 !)
117 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
122 ImportError: No module named 'hgext3rd.badext2' (py3 no-py36 !)
123 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py36 !)
118 124 *** failed to import extension badext2: No module named *badext2* (glob)
119 125 Traceback (most recent call last):
120 ModuleNotFoundError: No module named 'hgext.badext2' (py3 !)
126 ImportError: No module named 'hgext.badext2' (py3 no-py36 !)
127 ModuleNotFoundError: No module named 'hgext.badext2' (py36 !)
121 128 Traceback (most recent call last): (py3 !)
122 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py3 !)
129 ImportError: No module named 'hgext3rd.badext2' (py3 no-py36 !)
130 ModuleNotFoundError: No module named 'hgext3rd.badext2' (py36 !)
123 131 Traceback (most recent call last): (py3 !)
124 ModuleNotFoundError: No module named 'badext2' (py3 !)
132 ModuleNotFoundError: No module named 'badext2' (py36 !)
133 ImportError: No module named 'badext2' (py3 no-py36 !)
125 134 ImportError: No module named badext2 (no-py3 !)
126 135 YYYY/MM/DD HH:MM:SS (PID)> > loaded 2 extensions, total time * (glob)
127 136 YYYY/MM/DD HH:MM:SS (PID)> - loading configtable attributes
128 137 YYYY/MM/DD HH:MM:SS (PID)> - executing uisetup hooks
129 138 YYYY/MM/DD HH:MM:SS (PID)> - running uisetup for gpg
130 139 YYYY/MM/DD HH:MM:SS (PID)> > uisetup for gpg took * (glob)
131 140 YYYY/MM/DD HH:MM:SS (PID)> - running uisetup for baddocext
132 141 YYYY/MM/DD HH:MM:SS (PID)> > uisetup for baddocext took * (glob)
133 142 YYYY/MM/DD HH:MM:SS (PID)> > all uisetup took * (glob)
134 143 YYYY/MM/DD HH:MM:SS (PID)> - executing extsetup hooks
135 144 YYYY/MM/DD HH:MM:SS (PID)> - running extsetup for gpg
136 145 YYYY/MM/DD HH:MM:SS (PID)> > extsetup for gpg took * (glob)
137 146 YYYY/MM/DD HH:MM:SS (PID)> - running extsetup for baddocext
138 147 YYYY/MM/DD HH:MM:SS (PID)> > extsetup for baddocext took * (glob)
139 148 YYYY/MM/DD HH:MM:SS (PID)> > all extsetup took * (glob)
140 149 YYYY/MM/DD HH:MM:SS (PID)> - executing remaining aftercallbacks
141 150 YYYY/MM/DD HH:MM:SS (PID)> > remaining aftercallbacks completed in * (glob)
142 151 YYYY/MM/DD HH:MM:SS (PID)> - loading extension registration objects
143 152 YYYY/MM/DD HH:MM:SS (PID)> > extension registration object loading took * (glob)
144 153 YYYY/MM/DD HH:MM:SS (PID)> > extension baddocext take a total of * to load (glob)
145 154 YYYY/MM/DD HH:MM:SS (PID)> > extension gpg take a total of * to load (glob)
146 155 YYYY/MM/DD HH:MM:SS (PID)> extension loading complete
147 156 #endif
148 157
149 158 confirm that there's no crash when an extension's documentation is bad
150 159
151 160 $ hg help --keyword baddocext
152 161 *** failed to import extension badext from $TESTTMP/badext.py: bit bucket overflow
153 162 *** failed to import extension badext2: No module named *badext2* (glob)
154 163 Topics:
155 164
156 165 extensions Using Additional Features
General Comments 0
You need to be logged in to leave comments. Login now