3
3
4
4
machinery = util .import_importlib ('importlib.machinery' )
5
5
6
- from test .support import captured_stdout
6
+ from test .support import captured_stdout , impl_detail
7
7
import types
8
8
import unittest
9
9
import warnings
@@ -25,6 +25,7 @@ def exec_module(self, name):
25
25
self .assertEqual (module .__spec__ .origin , 'frozen' )
26
26
return module , stdout .getvalue ()
27
27
28
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
28
29
def test_module (self ):
29
30
name = '__hello__'
30
31
module , output = self .exec_module (name )
@@ -34,6 +35,7 @@ def test_module(self):
34
35
self .assertEqual (output , 'Hello world!\n ' )
35
36
self .assertTrue (hasattr (module , '__spec__' ))
36
37
38
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
37
39
def test_package (self ):
38
40
name = '__phello__'
39
41
module , output = self .exec_module (name )
@@ -46,6 +48,7 @@ def test_package(self):
46
48
expected = value ))
47
49
self .assertEqual (output , 'Hello world!\n ' )
48
50
51
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
49
52
def test_lacking_parent (self ):
50
53
name = '__phello__.spam'
51
54
with util .uncache ('__phello__' ):
@@ -59,6 +62,7 @@ def test_lacking_parent(self):
59
62
expected = value ))
60
63
self .assertEqual (output , 'Hello world!\n ' )
61
64
65
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
62
66
def test_module_repr (self ):
63
67
name = '__hello__'
64
68
module , output = self .exec_module (name )
@@ -68,6 +72,7 @@ def test_module_repr(self):
68
72
self .assertEqual (repr_str ,
69
73
"<module '__hello__' (frozen)>" )
70
74
75
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
71
76
def test_module_repr_indirect (self ):
72
77
name = '__hello__'
73
78
module , output = self .exec_module (name )
@@ -77,6 +82,7 @@ def test_module_repr_indirect(self):
77
82
# No way to trigger an error in a frozen module.
78
83
test_state_after_failure = None
79
84
85
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
80
86
def test_unloadable (self ):
81
87
assert self .machinery .FrozenImporter .find_module ('_not_real' ) is None
82
88
with self .assertRaises (ImportError ) as cm :
@@ -91,6 +97,7 @@ def test_unloadable(self):
91
97
92
98
class LoaderTests (abc .LoaderTests ):
93
99
100
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
94
101
def test_module (self ):
95
102
with util .uncache ('__hello__' ), captured_stdout () as stdout :
96
103
with warnings .catch_warnings ():
@@ -105,6 +112,7 @@ def test_module(self):
105
112
self .assertEqual (stdout .getvalue (), 'Hello world!\n ' )
106
113
self .assertFalse (hasattr (module , '__file__' ))
107
114
115
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
108
116
def test_package (self ):
109
117
with util .uncache ('__phello__' ), captured_stdout () as stdout :
110
118
with warnings .catch_warnings ():
@@ -123,6 +131,7 @@ def test_package(self):
123
131
self .assertEqual (stdout .getvalue (), 'Hello world!\n ' )
124
132
self .assertFalse (hasattr (module , '__file__' ))
125
133
134
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
126
135
def test_lacking_parent (self ):
127
136
with util .uncache ('__phello__' , '__phello__.spam' ), \
128
137
captured_stdout () as stdout :
@@ -141,6 +150,7 @@ def test_lacking_parent(self):
141
150
self .assertEqual (stdout .getvalue (), 'Hello world!\n ' )
142
151
self .assertFalse (hasattr (module , '__file__' ))
143
152
153
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
144
154
def test_module_reuse (self ):
145
155
with util .uncache ('__hello__' ), captured_stdout () as stdout :
146
156
with warnings .catch_warnings ():
@@ -151,6 +161,7 @@ def test_module_reuse(self):
151
161
self .assertEqual (stdout .getvalue (),
152
162
'Hello world!\n Hello world!\n ' )
153
163
164
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
154
165
def test_module_repr (self ):
155
166
with util .uncache ('__hello__' ), captured_stdout ():
156
167
with warnings .catch_warnings ():
@@ -160,6 +171,7 @@ def test_module_repr(self):
160
171
self .assertEqual (repr_str ,
161
172
"<module '__hello__' (frozen)>" )
162
173
174
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
163
175
def test_module_repr_indirect (self ):
164
176
with util .uncache ('__hello__' ), captured_stdout ():
165
177
module = self .machinery .FrozenImporter .load_module ('__hello__' )
@@ -169,6 +181,7 @@ def test_module_repr_indirect(self):
169
181
# No way to trigger an error in a frozen module.
170
182
test_state_after_failure = None
171
183
184
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
172
185
def test_unloadable (self ):
173
186
assert self .machinery .FrozenImporter .find_module ('_not_real' ) is None
174
187
with self .assertRaises (ImportError ) as cm :
@@ -185,6 +198,7 @@ class InspectLoaderTests:
185
198
186
199
"""Tests for the InspectLoader methods for FrozenImporter."""
187
200
201
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
188
202
def test_get_code (self ):
189
203
# Make sure that the code object is good.
190
204
name = '__hello__'
@@ -195,11 +209,13 @@ def test_get_code(self):
195
209
self .assertTrue (hasattr (mod , 'initialized' ))
196
210
self .assertEqual (stdout .getvalue (), 'Hello world!\n ' )
197
211
212
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
198
213
def test_get_source (self ):
199
214
# Should always return None.
200
215
result = self .machinery .FrozenImporter .get_source ('__hello__' )
201
216
self .assertIsNone (result )
202
217
218
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
203
219
def test_is_package (self ):
204
220
# Should be able to tell what is a package.
205
221
test_for = (('__hello__' , False ), ('__phello__' , True ),
@@ -208,6 +224,7 @@ def test_is_package(self):
208
224
result = self .machinery .FrozenImporter .is_package (name )
209
225
self .assertEqual (bool (result ), is_package )
210
226
227
+ @impl_detail ("GR-26392: add support for frozen modules" , graalvm = False )
211
228
def test_failure (self ):
212
229
# Raise ImportError for modules that are not frozen.
213
230
for meth_name in ('get_code' , 'get_source' , 'is_package' ):
0 commit comments