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