我想获得在从python调用的shell脚本中设置的退出状态.代码如下
python脚本.
result = os.system("./compile_cmd.sh")
print result
Run Code Online (Sandbox Code Playgroud)
(compile_cmd.sh)
javac @source.txt
#i do some code here to get the no of compilation errors
if [$error1 -e 0 ]
then
echo "\n********** JAVA compilation sucessfull **********"
exit 0
else
echo "\n** JAVA Compilation Error in file ** File not checked in to CVS **"
exit 1
fi
Run Code Online (Sandbox Code Playgroud)
我正在运行此代码.但无论我返回什么退出状态,我得到的结果var为0(我认为它返回shell脚本是否成功运行)我知道如何获取我在shell脚本中设置的退出状态python脚本??
如何模拟一个非静态、非final的void方法方法的签名如下。我正在使用 Powermockito。
public class Name{
public void methodName{
...
...
}
}
@RunWith(PowerMockRunner.class)
@PrepareForTest({Name.class})
public class TestClass{
@Test
public void testMethodName(){
PowerMockito.doNothing().when(Name.class, methodName);
//some when calls after this and assert later on
}
Run Code Online (Sandbox Code Playgroud)
当 methodName 被调用时我不想做任何事情。上面的代码不起作用。它说 methodName 无法解析。