def finalize(self, result):
        """Stop the mongodb instance.
        """

        if not self._running:
            return

        # Clear out the env variable.
        del os.environ["TEST_MONGODB"]
        del os.environ["TEST_MONGODB_DATABASE"]

        # Kill the mongod process
        if sys.platform == 'darwin':
            self.process.kill()
        else:
            self.process.terminate()
        self.process.wait()

        # Clean out the test data.
        shutil.rmtree(self.mongodb_param['db_path'])
        self._running = False
def finalize ( self , result ) : if not self . _running : return del os . environ [ "TEST_MONGODB" ] del os . environ [ "TEST_MONGODB_DATABASE" ] if sys . platform == 'darwin' : self . process . kill ( ) else : self . process . terminate ( ) self . process . wait ( ) shutil . rmtree ( self . mongodb_param [ 'db_path' ] ) self . _running = False
Stop the mongodb instance.