38
38
# SOFTWARE.
39
39
40
40
import os
41
+ from unittest import skipIf
42
+
41
43
import sys
42
44
43
45
if sys .implementation .name == "graalpython" :
44
46
import polyglot
47
+ from __graalpython__ import is_native
45
48
46
49
def test_import ():
47
50
def some_function ():
@@ -258,6 +261,7 @@ def test_key_info():
258
261
assert not polyglot .__key_info__ (builtinObj , "__len__" , "removable" )
259
262
assert not polyglot .__key_info__ (builtinObj , "__len__" , "insertable" )
260
263
264
+ @skipIf (is_native , "not supported in native mode" )
261
265
def test_java_classpath ():
262
266
import java
263
267
try :
@@ -270,6 +274,7 @@ def test_java_classpath():
270
274
except TypeError as e :
271
275
assert "classpath argument 2 must be string, not int" in str (e )
272
276
277
+ @skipIf (is_native , "not supported in native mode" )
273
278
def test_host_lookup ():
274
279
import java
275
280
try :
@@ -295,6 +300,7 @@ def test_internal_languages_dont_eval():
295
300
296
301
assert polyglot .eval (language = "python" , string = "21 * 2" ) == 42
297
302
303
+ @skipIf (is_native , "not supported in native mode" )
298
304
def test_non_index_array_access ():
299
305
import java
300
306
try :
@@ -305,6 +311,7 @@ def test_non_index_array_access():
305
311
except NotImplementedError as e :
306
312
assert "host lookup is not allowed" in str (e )
307
313
314
+ @skipIf (is_native , "not supported in native mode" )
308
315
def test_direct_call_of_truffle_object_methods ():
309
316
import java
310
317
try :
@@ -334,6 +341,7 @@ def test_array_element_info():
334
341
assert polyglot .__element_info__ (mutableObj , 0 , "modifiable" )
335
342
assert polyglot .__element_info__ (mutableObj , 4 , "insertable" )
336
343
344
+ @skipIf (is_native , "not supported in native mode" )
337
345
def test_java_imports ():
338
346
import java
339
347
try :
@@ -420,6 +428,7 @@ def test_java_exceptions():
420
428
else :
421
429
assert False
422
430
431
+ @skipIf (is_native , "not supported in native mode" )
423
432
def test_foreign_object_does_not_leak_Javas_toString ():
424
433
try :
425
434
from java .util import ArrayList
@@ -458,6 +467,7 @@ def test_java_import_star():
458
467
assert "getGlobal" in d
459
468
assert d ["getGlobal" ]().getName () == d ["GLOBAL_LOGGER_NAME" ]
460
469
470
+ @skipIf (is_native , "not supported in native mode" )
461
471
def test_java_null_is_none ():
462
472
import java .lang .Integer as Integer
463
473
x = Integer .getInteger ("something_what_does_not_exists" )
0 commit comments