Skip to content

Commit 64f0182

Browse files
committed
test context reuse
1 parent 32dee4a commit 64f0182

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.oracle.graal.python.test.advance;
2+
3+
import org.graalvm.polyglot.Context;
4+
import org.graalvm.polyglot.Engine;
5+
import org.junit.Test;
6+
7+
import com.oracle.graal.python.test.PythonTests;
8+
9+
public class MultiContextTest extends PythonTests {
10+
@Test
11+
public void testContextReuse() {
12+
Engine engine = Engine.newBuilder().build();
13+
for (int i = 0; i < 10; i++) {
14+
try (Context context = newContext(engine)) {
15+
context.eval("python", "memoryview(b'abc')");
16+
}
17+
}
18+
}
19+
20+
private static Context newContext(Engine engine) {
21+
return Context.newBuilder().allowAllAccess(true).engine(engine).build();
22+
}
23+
}

0 commit comments

Comments
 (0)