File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
graalpython/com.oracle.graal.python.test/src/com/oracle/graal/python/test/advance Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments