<commit_before>import shutil
import os

import pytest

from cloudstorage.drivers.local import LocalDriver
from cloudstorage.exceptions import (
    CredentialsError,
    IsNotEmptyError,
    NotFoundError,
    SignatureExpiredError,
)
from tests.helpers import random_container_name, uri_validator
from tests.settings import *

if not os.path.exists(LOCAL_KEY):
    os.makedirs(LOCAL_KEY)

pytestmark = pytest.mark.skipif(not os.path.isdir(LOCAL_KEY),
                                reason='Directory does not exist.')


@pytest.fixture(scope='module')
def storage():
    driver = LocalDriver(key=LOCAL_KEY, secret=LOCAL_SECRET)

    yield driver

    for container in driver:  # cleanup
        if container.name.startswith(CONTAINER_PREFIX):<commit_msg>Move create directory logic and skip if LOCAL_KEY not set<commit_after>import shutil
import os

import pytest

from cloudstorage.drivers.local import LocalDriver
from cloudstorage.exceptions import (
    CredentialsError,
    IsNotEmptyError,
    NotFoundError,
    SignatureExpiredError,
)
from tests.helpers import random_container_name, uri_validator
from tests.settings import *

if LOCAL_KEY and not os.path.exists(LOCAL_KEY):
    os.makedirs(LOCAL_KEY)

pytestmark = pytest.mark.skipif(not os.path.isdir(LOCAL_KEY),
                                reason='Directory does not exist.')


@pytest.fixture(scope='module')
def storage():
    driver = LocalDriver(key=LOCAL_KEY, secret=LOCAL_SECRET)

    yield driver

    for container in driver:  # cleanup
        if container.name.startswith(CONTAINER_PREFIX):
{'fraction_non_alphanumeric': 0.07770700636942675, 'fraction_numerical': 0.0, 'mean_word_length': 3.940251572327044, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7560467', 'n_tokens_mistral': 480, 'n_tokens_neox': 473, 'n_words': 112}