Skip to content

Commit 4d4df5e

Browse files
committed
test_importlib: skip threading and frozen module tests
1 parent d937a83 commit 4d4df5e

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

graalpython/lib-python/3/test/test_importlib/frozen/test_finder.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
machinery = util.import_importlib('importlib.machinery')
55

66
import unittest
7+
from test.support import impl_detail
78

89

910
class FindSpecTests(abc.FinderTests):
@@ -14,15 +15,18 @@ def find(self, name, path=None):
1415
finder = self.machinery.FrozenImporter
1516
return finder.find_spec(name, path)
1617

18+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
1719
def test_module(self):
1820
name = '__hello__'
1921
spec = self.find(name)
2022
self.assertEqual(spec.origin, 'frozen')
2123

24+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
2225
def test_package(self):
2326
spec = self.find('__phello__')
2427
self.assertIsNotNone(spec)
2528

29+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
2630
def test_module_in_package(self):
2731
spec = self.find('__phello__.spam', ['__phello__'])
2832
self.assertIsNotNone(spec)
@@ -51,15 +55,18 @@ def find(self, name, path=None):
5155
finder = self.machinery.FrozenImporter
5256
return finder.find_module(name, path)
5357

58+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
5459
def test_module(self):
5560
name = '__hello__'
5661
loader = self.find(name)
5762
self.assertTrue(hasattr(loader, 'load_module'))
5863

64+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
5965
def test_package(self):
6066
loader = self.find('__phello__')
6167
self.assertTrue(hasattr(loader, 'load_module'))
6268

69+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
6370
def test_module_in_package(self):
6471
loader = self.find('__phello__.spam', ['__phello__'])
6572
self.assertTrue(hasattr(loader, 'load_module'))

graalpython/lib-python/3/test/test_importlib/frozen/test_loader.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
machinery = util.import_importlib('importlib.machinery')
55

6-
from test.support import captured_stdout
6+
from test.support import captured_stdout, impl_detail
77
import types
88
import unittest
99
import warnings
@@ -25,6 +25,7 @@ def exec_module(self, name):
2525
self.assertEqual(module.__spec__.origin, 'frozen')
2626
return module, stdout.getvalue()
2727

28+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
2829
def test_module(self):
2930
name = '__hello__'
3031
module, output = self.exec_module(name)
@@ -34,6 +35,7 @@ def test_module(self):
3435
self.assertEqual(output, 'Hello world!\n')
3536
self.assertTrue(hasattr(module, '__spec__'))
3637

38+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
3739
def test_package(self):
3840
name = '__phello__'
3941
module, output = self.exec_module(name)
@@ -46,6 +48,7 @@ def test_package(self):
4648
expected=value))
4749
self.assertEqual(output, 'Hello world!\n')
4850

51+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
4952
def test_lacking_parent(self):
5053
name = '__phello__.spam'
5154
with util.uncache('__phello__'):
@@ -59,6 +62,7 @@ def test_lacking_parent(self):
5962
expected=value))
6063
self.assertEqual(output, 'Hello world!\n')
6164

65+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
6266
def test_module_repr(self):
6367
name = '__hello__'
6468
module, output = self.exec_module(name)
@@ -68,6 +72,7 @@ def test_module_repr(self):
6872
self.assertEqual(repr_str,
6973
"<module '__hello__' (frozen)>")
7074

75+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
7176
def test_module_repr_indirect(self):
7277
name = '__hello__'
7378
module, output = self.exec_module(name)
@@ -77,6 +82,7 @@ def test_module_repr_indirect(self):
7782
# No way to trigger an error in a frozen module.
7883
test_state_after_failure = None
7984

85+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
8086
def test_unloadable(self):
8187
assert self.machinery.FrozenImporter.find_module('_not_real') is None
8288
with self.assertRaises(ImportError) as cm:
@@ -91,6 +97,7 @@ def test_unloadable(self):
9197

9298
class LoaderTests(abc.LoaderTests):
9399

100+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
94101
def test_module(self):
95102
with util.uncache('__hello__'), captured_stdout() as stdout:
96103
with warnings.catch_warnings():
@@ -105,6 +112,7 @@ def test_module(self):
105112
self.assertEqual(stdout.getvalue(), 'Hello world!\n')
106113
self.assertFalse(hasattr(module, '__file__'))
107114

115+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
108116
def test_package(self):
109117
with util.uncache('__phello__'), captured_stdout() as stdout:
110118
with warnings.catch_warnings():
@@ -123,6 +131,7 @@ def test_package(self):
123131
self.assertEqual(stdout.getvalue(), 'Hello world!\n')
124132
self.assertFalse(hasattr(module, '__file__'))
125133

134+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
126135
def test_lacking_parent(self):
127136
with util.uncache('__phello__', '__phello__.spam'), \
128137
captured_stdout() as stdout:
@@ -141,6 +150,7 @@ def test_lacking_parent(self):
141150
self.assertEqual(stdout.getvalue(), 'Hello world!\n')
142151
self.assertFalse(hasattr(module, '__file__'))
143152

153+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
144154
def test_module_reuse(self):
145155
with util.uncache('__hello__'), captured_stdout() as stdout:
146156
with warnings.catch_warnings():
@@ -151,6 +161,7 @@ def test_module_reuse(self):
151161
self.assertEqual(stdout.getvalue(),
152162
'Hello world!\nHello world!\n')
153163

164+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
154165
def test_module_repr(self):
155166
with util.uncache('__hello__'), captured_stdout():
156167
with warnings.catch_warnings():
@@ -160,6 +171,7 @@ def test_module_repr(self):
160171
self.assertEqual(repr_str,
161172
"<module '__hello__' (frozen)>")
162173

174+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
163175
def test_module_repr_indirect(self):
164176
with util.uncache('__hello__'), captured_stdout():
165177
module = self.machinery.FrozenImporter.load_module('__hello__')
@@ -169,6 +181,7 @@ def test_module_repr_indirect(self):
169181
# No way to trigger an error in a frozen module.
170182
test_state_after_failure = None
171183

184+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
172185
def test_unloadable(self):
173186
assert self.machinery.FrozenImporter.find_module('_not_real') is None
174187
with self.assertRaises(ImportError) as cm:
@@ -185,6 +198,7 @@ class InspectLoaderTests:
185198

186199
"""Tests for the InspectLoader methods for FrozenImporter."""
187200

201+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
188202
def test_get_code(self):
189203
# Make sure that the code object is good.
190204
name = '__hello__'
@@ -195,11 +209,13 @@ def test_get_code(self):
195209
self.assertTrue(hasattr(mod, 'initialized'))
196210
self.assertEqual(stdout.getvalue(), 'Hello world!\n')
197211

212+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
198213
def test_get_source(self):
199214
# Should always return None.
200215
result = self.machinery.FrozenImporter.get_source('__hello__')
201216
self.assertIsNone(result)
202217

218+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
203219
def test_is_package(self):
204220
# Should be able to tell what is a package.
205221
test_for = (('__hello__', False), ('__phello__', True),
@@ -208,6 +224,7 @@ def test_is_package(self):
208224
result = self.machinery.FrozenImporter.is_package(name)
209225
self.assertEqual(bool(result), is_package)
210226

227+
@impl_detail("GR-26392: add support for frozen modules", graalvm=False)
211228
def test_failure(self):
212229
# Raise ImportError for modules that are not frozen.
213230
for meth_name in ('get_code', 'get_source', 'is_package'):

graalpython/lib-python/3/test/test_importlib/test_locks.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class ModuleLockAsRLockTests:
3131
LOCK_TYPES = {kind: splitinit._bootstrap._ModuleLock
3232
for kind, splitinit in init.items()}
3333

34-
(Frozen_ModuleLockAsRLockTests,
35-
Source_ModuleLockAsRLockTests
36-
) = test_util.test_both(ModuleLockAsRLockTests, lock_tests.RLockTests,
37-
LockType=LOCK_TYPES)
34+
# "GR-16579: support for multi-threading"
35+
# (Frozen_ModuleLockAsRLockTests,
36+
# Source_ModuleLockAsRLockTests
37+
# ) = test_util.test_both(ModuleLockAsRLockTests, lock_tests.RLockTests,
38+
# LockType=LOCK_TYPES)
3839

3940

4041
class DeadlockAvoidanceTests:
@@ -95,6 +96,7 @@ def test_deadlock(self):
9596
self.assertGreaterEqual(nb_deadlocks, 1)
9697
self.assertEqual(results.count((True, True)), len(results) - nb_deadlocks)
9798

99+
@support.impl_detail("GR-16579: support for multi-threading", graalvm=False)
98100
def test_no_deadlock(self):
99101
results = self.run_deadlock_avoidance_test(False)
100102
self.assertEqual(results.count((True, False)), 0)
@@ -104,11 +106,12 @@ def test_no_deadlock(self):
104106
DEADLOCK_ERRORS = {kind: splitinit._bootstrap._DeadlockError
105107
for kind, splitinit in init.items()}
106108

107-
(Frozen_DeadlockAvoidanceTests,
108-
Source_DeadlockAvoidanceTests
109-
) = test_util.test_both(DeadlockAvoidanceTests,
110-
LockType=LOCK_TYPES,
111-
DeadlockError=DEADLOCK_ERRORS)
109+
# "GR-16579: support for multi-threading"
110+
# (Frozen_DeadlockAvoidanceTests,
111+
# Source_DeadlockAvoidanceTests
112+
# ) = test_util.test_both(DeadlockAvoidanceTests,
113+
# LockType=LOCK_TYPES,
114+
# DeadlockError=DEADLOCK_ERRORS)
112115

113116

114117
class LifetimeTests:
@@ -117,6 +120,7 @@ class LifetimeTests:
117120
def bootstrap(self):
118121
return self.init._bootstrap
119122

123+
@support.impl_detail("GR-16579: support for multi-threading", graalvm=False)
120124
def test_lock_lifetime(self):
121125
name = "xyzzy"
122126
self.assertNotIn(name, self.bootstrap._module_locks)
@@ -128,6 +132,7 @@ def test_lock_lifetime(self):
128132
self.assertNotIn(name, self.bootstrap._module_locks)
129133
self.assertIsNone(wr())
130134

135+
@support.impl_detail("GR-16579: support for multi-threading", graalvm=False)
131136
def test_all_locks(self):
132137
support.gc_collect()
133138
self.assertEqual(0, len(self.bootstrap._module_locks),
@@ -141,10 +146,10 @@ def test_all_locks(self):
141146

142147
@support.reap_threads
143148
def test_main():
144-
support.run_unittest(Frozen_ModuleLockAsRLockTests,
145-
Source_ModuleLockAsRLockTests,
146-
Frozen_DeadlockAvoidanceTests,
147-
Source_DeadlockAvoidanceTests,
149+
support.run_unittest(#Frozen_ModuleLockAsRLockTests,
150+
#Source_ModuleLockAsRLockTests,
151+
#Frozen_DeadlockAvoidanceTests,
152+
#Source_DeadlockAvoidanceTests,
148153
Frozen_LifetimeTests,
149154
Source_LifetimeTests)
150155

0 commit comments

Comments
 (0)