Skip to content

Commit 4e0bd0b

Browse files
committed
Allow experimental options for engines only in the isolate tests
1 parent fb2211b commit 4e0bd0b

21 files changed

+39
-32
lines changed

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/EngineOptionsTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class EngineOptionsTests {
5353
@Test
5454
public void engineOptions() {
5555
assumeFalse(IS_WINDOWS);
56-
Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build();
56+
Engine engine = Engine.create("python");
5757

5858
assertEquals("java", doit(engine, null));
5959
assertEquals("java", doit(engine, "java"));

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/PythonTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public class PythonTests {
5858
static final PrintStream errStream = new PrintStream(errArray);
5959
static final PrintStream outStream = new PrintStream(outArray);
6060

61-
private static final Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).out(PythonTests.outStream).err(PythonTests.errStream).build();
61+
private static final Engine engine = Engine.newBuilder("python").out(PythonTests.outStream).err(PythonTests.errStream).build();
6262
private static Context context = null;
6363

6464
public static Context enterContext(String... newArgs) {

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/advanced/MultiContextTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
public class MultiContextTest extends PythonTests {
5050
@Test
5151
public void testSharingWithMemoryview() {
52-
Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build();
52+
Engine engine = Engine.create("python");
5353
for (int i = 0; i < 10; i++) {
5454
try (Context context = newContext(engine)) {
5555
context.eval("python", "memoryview(b'abc')");
@@ -59,7 +59,7 @@ public void testSharingWithMemoryview() {
5959

6060
@Test
6161
public void testTryCatch() {
62-
Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build();
62+
Engine engine = Engine.create("python");
6363
for (int i = 0; i < 10; i++) {
6464
try (Context context = newContext(engine)) {
6565
context.eval("python", "last_val = -1\n" +

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/advanced/NativeExtTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public static void setUpClass() {
6363
@Test
6464
public void testSharingErrorWithCpythonSre() throws InterruptedException {
6565
// The first context is the one that will use native extensions
66-
Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build();
66+
Engine engine = Engine.create("python");
6767
Context cextContext = newContext(engine).option("python.IsolateNativeModules", "true").build();
6868
try {
6969
cextContext.eval("python", "import _cpython_sre\nassert _cpython_sre.ascii_tolower(88) == 120\n");

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/advanced/ResourcesTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void testResourcesAsHome() {
7373

7474
@Test
7575
public void testResourcesAlwaysAllowReading() {
76-
try (Context context = Context.newBuilder("python").engine(Engine.newBuilder("python").allowExperimentalOptions(true).build()).allowIO(IOAccess.NONE).option("python.PythonHome", "/path/that/does/not/exist").build()) {
76+
try (Context context = Context.newBuilder("python").engine(Engine.create("python")).allowIO(IOAccess.NONE).option("python.PythonHome", "/path/that/does/not/exist").build()) {
7777
String foundHome = context.eval("python", "import email; email.__spec__.origin").asString();
7878
assertTrue(foundHome, foundHome.contains("python" + File.separator + "python-home"));
7979
}

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/advanced/ShutdownTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public void testJavaThreadNotExecutingPythonAnymore() throws InterruptedExceptio
162162
}
163163

164164
private static Context createContext() {
165-
return Context.newBuilder().engine(Engine.newBuilder("python").allowExperimentalOptions(true).build()).allowExperimentalOptions(true).allowAllAccess(true).option("python.IsolateNativeModules", "true").build();
165+
return Context.newBuilder().engine(Engine.create("python")).allowExperimentalOptions(true).allowAllAccess(true).option("python.IsolateNativeModules", "true").build();
166166
}
167167

168168
private static void loadNativeExtension(Context context) {

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/basic/HelloWorldTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ public void helloworldAgain() {
5454
public void usesFrozenModules() {
5555
final ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
5656
final PrintStream printStream = new PrintStream(byteArray);
57-
try (Context c = Context.newBuilder().engine(Engine.newBuilder("python").allowExperimentalOptions(true).build()).option("log.python.level", "FINE").out(printStream).err(printStream).build()) {
57+
try (Context c = Context.newBuilder()
58+
.engine(Engine.newBuilder("python")
59+
.out(printStream)
60+
.err(printStream)
61+
.build())
62+
.option("log.python.level", "FINE")
63+
.build()) {
5864
c.initialize("python");
5965
}
6066
String result = byteArray.toString().replaceAll("\r\n", "\n");

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/engine/SharedEngineMultithreadingImportsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class SharedEngineMultithreadingImportsTest extends SharedEngineMultithre
5555
public void testImportsInParallel() throws InterruptedException, ExecutionException {
5656
ExecutorService executorService = createExecutorService();
5757
for (int runIndex = 0; runIndex < RUNS_COUNT; runIndex++) {
58-
try (Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build()) {
58+
try (Engine engine = Engine.create("python")) {
5959
Task[] tasks = new Task[Runtime.getRuntime().availableProcessors()];
6060
Arrays.fill(tasks, (Task) () -> {
6161
try (InitializedContext ctx = initContext(engine, new String[0])) {

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/engine/SharedEngineMultithreadingOSRAndQuickeningTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_buffer():
136136
public void testOSRAndQuickenInParallel() throws InterruptedException, ExecutionException {
137137
ExecutorService executorService = createExecutorService();
138138
InitializedContext[] contexts = new InitializedContext[Runtime.getRuntime().availableProcessors()];
139-
try (Engine e = Engine.newBuilder("python").allowExperimentalOptions(true).build()) {
139+
try (Engine e = Engine.create("python")) {
140140
// No point in this test if compiler is enabled and OSR cannot be configured
141141
Assume.assumeNotNull(e.getOptions().get("engine.OSRCompilationThreshold"));
142142
}

graalpython/com.oracle.graal.python.test.integration/src/com/oracle/graal/python/test/integration/engine/SharedEngineMultithreadingQuickeningTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void testQuickenInParallel() throws InterruptedException, ExecutionExcept
6060
InitializedContext[] contexts = new InitializedContext[Runtime.getRuntime().availableProcessors()];
6161
Random random = new Random();
6262
for (int runIndex = 0; runIndex < RUNS_COUNT; runIndex++) {
63-
try (Engine engine = Engine.newBuilder("python").allowExperimentalOptions(true).build()) {
63+
try (Engine engine = Engine.create("python")) {
6464
for (int i = 0; i < contexts.length; i++) {
6565
contexts[i] = initContext(engine, new String[0]);
6666
}

0 commit comments

Comments
 (0)