Skip to content

Commit e58ebcb

Browse files
committed
JythonTest: add test of os.getpid()
The test fails with versions of jython-shaded before 2.7.1.1; e.g.: mvn -Djython-shaded.version=2.7.1 test See scijava/jython-shaded#5.
1 parent 1c43d53 commit e58ebcb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/java/org/scijava/plugins/scripting/jython/JythonTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import static org.junit.Assert.assertEquals;
3535
import static org.junit.Assert.assertNull;
3636
import static org.junit.Assert.assertSame;
37+
import static org.junit.Assert.assertTrue;
3738

3839
import java.io.IOException;
3940
import java.math.BigInteger;
@@ -167,4 +168,19 @@ public void testEval() throws ScriptException {
167168
final Object varAssign = engine.eval("a = 4 + 5");
168169
assertNull(varAssign);
169170
}
171+
172+
@Test
173+
public void testGetPID() throws InterruptedException, ExecutionException,
174+
IOException, ScriptException
175+
{
176+
final String script = "" + //
177+
"#@output Object pid\n" + //
178+
"import os\n" + //
179+
"pid = os.getpid()\n";
180+
final ScriptModule m = scriptService.run("getpid.py", script, true).get();
181+
182+
final Object pid = m.getOutput("pid");
183+
assertTrue(pid instanceof Number);
184+
assertTrue(((Number) pid).longValue() > 0);
185+
}
170186
}

0 commit comments

Comments
 (0)