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