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