mercredi 29 juillet 2020

call function when all tests are finished running

I want to run some cleanup code like stopping database service. I am currently using std::sync::Once::call_once like this:-

fn init() {
    INIT.call_once(|| {
        //start database
    });
}

I put this function in each test. But now I want to run another function which will be executed when all tests are finished. How can I do that ?

Aucun commentaire:

Enregistrer un commentaire