you mocked method utils execute it raises exception  so here you have to use self assertraises processutils processexecutionerror  crypto ensure ca filesystem otherwise this exception will be raised in this test and you get a test fail because of this exception 