3838# SOFTWARE.
3939
4040import os
41+ from unittest import skipIf
42+
4143import sys
4244
4345if sys .implementation .name == "graalpython" :
4446 import polyglot
47+ from __graalpython__ import is_native
4548
4649 def test_import ():
4750 def some_function ():
@@ -258,6 +261,7 @@ def test_key_info():
258261 assert not polyglot .__key_info__ (builtinObj , "__len__" , "removable" )
259262 assert not polyglot .__key_info__ (builtinObj , "__len__" , "insertable" )
260263
264+ @skipIf (is_native , "not supported in native mode" )
261265 def test_java_classpath ():
262266 import java
263267 try :
@@ -270,6 +274,7 @@ def test_java_classpath():
270274 except TypeError as e :
271275 assert "classpath argument 2 must be string, not int" in str (e )
272276
277+ @skipIf (is_native , "not supported in native mode" )
273278 def test_host_lookup ():
274279 import java
275280 try :
@@ -295,6 +300,7 @@ def test_internal_languages_dont_eval():
295300
296301 assert polyglot .eval (language = "python" , string = "21 * 2" ) == 42
297302
303+ @skipIf (is_native , "not supported in native mode" )
298304 def test_non_index_array_access ():
299305 import java
300306 try :
@@ -305,6 +311,7 @@ def test_non_index_array_access():
305311 except NotImplementedError as e :
306312 assert "host lookup is not allowed" in str (e )
307313
314+ @skipIf (is_native , "not supported in native mode" )
308315 def test_direct_call_of_truffle_object_methods ():
309316 import java
310317 try :
@@ -334,6 +341,7 @@ def test_array_element_info():
334341 assert polyglot .__element_info__ (mutableObj , 0 , "modifiable" )
335342 assert polyglot .__element_info__ (mutableObj , 4 , "insertable" )
336343
344+ @skipIf (is_native , "not supported in native mode" )
337345 def test_java_imports ():
338346 import java
339347 try :
@@ -420,6 +428,7 @@ def test_java_exceptions():
420428 else :
421429 assert False
422430
431+ @skipIf (is_native , "not supported in native mode" )
423432 def test_foreign_object_does_not_leak_Javas_toString ():
424433 try :
425434 from java .util import ArrayList
@@ -458,6 +467,7 @@ def test_java_import_star():
458467 assert "getGlobal" in d
459468 assert d ["getGlobal" ]().getName () == d ["GLOBAL_LOGGER_NAME" ]
460469
470+ @skipIf (is_native , "not supported in native mode" )
461471 def test_java_null_is_none ():
462472 import java .lang .Integer as Integer
463473 x = Integer .getInteger ("something_what_does_not_exists" )
0 commit comments