File tree Expand file tree Collapse file tree
src/test/java/org/scijava/plugins/scripting/jython Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3434import static org .junit .Assert .assertEquals ;
3535import static org .junit .Assert .assertNull ;
3636import static org .junit .Assert .assertSame ;
37+ import static org .junit .Assert .assertTrue ;
3738
3839import java .io .IOException ;
3940import 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}
You can’t perform that action at this time.
0 commit comments