@@ -70,8 +70,8 @@ def get_gp():
70
70
print (
71
71
"Standalone module tests require a GraalVM installation including graalpy, java, javac and native-image" ,
72
72
"Please point the JAVA_HOME environment variable to such a GraalVM root." ,
73
- "__graalpython__.home : " + java_home ,
74
- "native-image exists: " + str (os .path .exists (ni )),
73
+ "__graalpython__.home : " + java_home ,
74
+ "native-image exists: " + str (os .path .exists (ni )),
75
75
"javac exists: " + str (os .path .exists (jc )),
76
76
"graalpy exits: " + str (os .path .exists (graalpy )),
77
77
"java exists: " + str (os .path .exists (java )),
@@ -114,7 +114,7 @@ def test_polyglot_app():
114
114
115
115
java_home , graalpy , java = get_gp ()
116
116
env = get_env (java_home )
117
-
117
+
118
118
with tempfile .TemporaryDirectory () as tmpdir :
119
119
120
120
target_dir = os .path .join (tmpdir , "polyglot_app_test" )
@@ -166,7 +166,8 @@ def test_native_executable_one_file():
166
166
167
167
source_file = os .path .join (tmpdir , "hello.py" )
168
168
with open (source_file , 'w' ) as f :
169
- f .write ("print('hello world')" )
169
+ f .write ("import sys\n " )
170
+ f .write ("print('hello world, argv[1:]:', sys.argv[1:])" )
170
171
171
172
target_file = os .path .join (tmpdir , "hello" )
172
173
cmd = [graalpy , "-m" , "standalone" , "--verbose" , "native" , "-m" , source_file , "-o" , target_file ]
@@ -177,12 +178,12 @@ def test_native_executable_one_file():
177
178
print (p .stderr .decode (errors = 'backslashreplace' ))
178
179
assert "Bundling Python resources into" in out
179
180
180
- cmd = [target_file ]
181
- p = subprocess .run (cmd , env = env , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
181
+ cmd = [target_file , "arg1" , "arg2" ]
182
+ p = subprocess .run (" " . join ( cmd ) , env = env , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
182
183
out = p .stdout .decode (errors = 'backslashreplace' )
183
184
print (out )
184
185
print (p .stderr .decode (errors = 'backslashreplace' ))
185
- assert "hello world" in out
186
+ assert "hello world, argv[1:]: " + str ( cmd [ 1 :]) in out
186
187
187
188
@unittest .skipUnless (is_enabled , "ENABLE_STANDALONE_UNITTESTS is not true" )
188
189
def test_native_executable_one_file_venv ():
0 commit comments