def _create_temp_dir(self, dir_name, verbose=True):
    '\n        Create a directory that will be deleted when this test class is torn\n        down.\n        '
    if verbose:
        logger.debug(('creating ' + dir_name))
    try:
        os.mkdir(dir_name)
    except OSError as e:
        if (e.errno != errno.EEXIST):
            logger.debug((dir_name + ' already exists. removing and recreating.'))
            shutil.rmtree(dir_name)
            os.mkdir(dir_name)
        else:
            raise e

    def debug_and_rmtree():
        shutil.rmtree(dir_name)
        logger.debug((dir_name + ' removed'))
    self.addCleanup(debug_and_rmtree)
Create a directory that will be deleted when this test class is torn
down.
def _create_temp_dir(self, dir_name, verbose=True):
    '\n        Create a directory that will be deleted when this test class is torn\n        down.\n        '
    if verbose:
        logger.debug(('creating ' + dir_name))
    try:
        os.mkdir(dir_name)
    except OSError as e:
        if (e.errno != errno.EEXIST):
            logger.debug((dir_name + ' already exists. removing and recreating.'))
            shutil.rmtree(dir_name)
            os.mkdir(dir_name)
        else:
            raise e

    def debug_and_rmtree():
        shutil.rmtree(dir_name)
        logger.debug((dir_name + ' removed'))
    self.addCleanup(debug_and_rmtree)