Skip to content

Commit 3bc5ec1

Browse files
authored
[test] Add requires_jspi decorator. NFC (#21976)
1 parent b01e901 commit 3bc5ec1

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

test/test_other.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ def decorated(self, *args, **kwargs):
199199
return decorated
200200

201201

202+
def requires_jspi(func):
203+
assert callable(func)
204+
205+
@wraps(func)
206+
def decorated(self, *args, **kwargs):
207+
self.require_jspi()
208+
return func(self, *args, **kwargs)
209+
210+
return decorated
211+
212+
202213
def llvm_nm(file):
203214
output = shared.run_process([LLVM_NM, file], stdout=PIPE).stdout
204215

@@ -3061,8 +3072,8 @@ def test_embind_asyncify(self):
30613072
'': ['-sDYNAMIC_EXECUTION=1'],
30623073
'no_dynamic': ['-sDYNAMIC_EXECUTION=0'],
30633074
})
3075+
@requires_jspi
30643076
def test_embind_jspi(self, extra):
3065-
self.require_jspi()
30663077
self.emcc_args += ['-lembind', '-g']
30673078
self.emcc_args += [extra]
30683079

@@ -3202,19 +3213,19 @@ def test_embind_return_value_policy(self):
32023213

32033214
self.do_runf('embind/test_return_value_policy.cpp')
32043215

3216+
@requires_jspi
32053217
@parameterized({
32063218
'': [['-sJSPI_EXPORTS=async*']],
32073219
'deprecated': [['-Wno-deprecated', '-sASYNCIFY_EXPORTS=async*']]
32083220
})
32093221
def test_jspi_wildcard(self, opts):
3210-
self.require_jspi()
32113222
self.emcc_args += opts
32123223

32133224
self.do_runf('other/test_jspi_wildcard.c', 'done')
32143225

3226+
@requires_jspi
32153227
def test_jspi_add_function(self):
32163228
# make sure synchronous functions in the wasmTable aren't processed with Asyncify.makeAsyncFunction
3217-
self.require_jspi()
32183229
self.emcc_args += [
32193230
'-sASYNCIFY=2',
32203231
'-sEXPORTED_RUNTIME_METHODS=addFunction,dynCall',

0 commit comments

Comments
 (0)