File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -168,3 +168,45 @@ def test_call_nogil(yld, raw):
168
168
t2 = time () - t0
169
169
# executing the tasks should take about 1 second because they happen in parallel
170
170
assert 0.9 < t2 < 1.5
171
+
172
+
173
+ def test_repl ():
174
+ import sys
175
+ import tomllib
176
+ import juliapkg
177
+ import juliacall as _
178
+ import subprocess
179
+ import time
180
+
181
+ jl_version = juliapkg .state .STATE ["version" ]
182
+
183
+ # grab PythonCall.jl version from pyproject.toml
184
+ with open ("pyproject.toml" , "rb" ) as f :
185
+ pyproject = tomllib .load (f )
186
+ pythoncall_version = pyproject ["project" ]["version" ]
187
+
188
+ cmd = [sys .executable , '-m' , 'juliacall' ]
189
+ process = subprocess .Popen (
190
+ cmd ,
191
+ stdin = subprocess .PIPE ,
192
+ stdout = subprocess .PIPE ,
193
+ stderr = subprocess .PIPE ,
194
+ text = True ,
195
+ bufsize = 1
196
+ )
197
+ output = ""
198
+ timestart = time .time ()
199
+ while time .time () - timestart < 100 :
200
+ char = process .stdout .read (1 )
201
+ if not char :
202
+ break
203
+ output += char
204
+ if output .endswith ("julia>" ):
205
+ break
206
+ assert f"Julia: { jl_version } " in output
207
+ assert f"PythonCall: { pythoncall_version } " in output
208
+ assert "julia>" in output
209
+ process .stdin .write ('\x04 ' ) # Ctrl+D
210
+ process .stdin .flush ()
211
+ process .wait ()
212
+ assert process .returncode == 0
You can’t perform that action at this time.
0 commit comments