You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: graalpython/com.oracle.graal.python.test/src/org/graalvm/python/embedding/cext/test/MultiContextCExtTest.java
+68-61Lines changed: 68 additions & 61 deletions
Original file line number
Diff line number
Diff line change
@@ -183,69 +183,76 @@ public void testCreatingVenvForMulticontext() throws IOException {
assertTrue("created a copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup0")));
191
-
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup1")));
192
-
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
222
-
// Third one works and triggers a dynamic relocation
223
-
c3.eval(code);
224
-
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
225
-
// Fourth one does not work because we changed the sys.prefix
226
-
c4.eval("python", "import sys; sys.prefix = 12");
186
+
varcontexts = newArrayList<Context>();
227
187
try {
228
-
c4.eval(code);
229
-
fail("should not reach here");
230
-
} catch (PolyglotExceptione) {
231
-
assertTrue("We rely on sys.prefix", e.getMessage().contains("sys.prefix must be a str"));
232
-
}
233
-
// Fifth one does not work because we don't have the venv configured
234
-
try {
235
-
c5.eval(code);
236
-
fail("should not reach here");
237
-
} catch (PolyglotExceptione) {
238
-
assertTrue("We need a venv", e.getMessage().contains("sys.prefix must point to a venv"));
239
-
}
240
-
// Using a context without isolation in the same process needs to use LLVM
241
-
assertFalse("have not had a context use LLVM, yet", log.truffleLog.toString().contains("as bitcode"));
assertTrue("created a copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup0")));
194
+
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup1")));
195
+
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
assertFalse("created no more copies of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
225
+
// Third one works and triggers a dynamic relocation
226
+
c3.eval(code);
227
+
assertTrue("created another copy of the capi", Files.list(venv).anyMatch((p) -> p.getFileName().toString().startsWith(pythonNative) && p.getFileName().toString().endsWith(".dup2")));
228
+
// Fourth one does not work because we changed the sys.prefix
229
+
c4.eval("python", "import sys; sys.prefix = 12");
230
+
try {
231
+
c4.eval(code);
232
+
fail("should not reach here");
233
+
} catch (PolyglotExceptione) {
234
+
assertTrue("We rely on sys.prefix", e.getMessage().contains("sys.prefix must be a str"));
235
+
}
236
+
// Fifth one does not work because we don't have the venv configured
237
+
try {
238
+
c5.eval(code);
239
+
fail("should not reach here");
240
+
} catch (PolyglotExceptione) {
241
+
assertTrue("We need a venv", e.getMessage().contains("sys.prefix must point to a venv"));
242
+
}
243
+
// Using a context without isolation in the same process needs to use LLVM
244
+
assertFalse("have not had a context use LLVM, yet", log.truffleLog.toString().contains("as bitcode"));
0 commit comments