<commit_before>import json
import re
import shutil
import time
import zipfile
import pytest
import tempfile
import os
import pydov

from pydov.search.boring import BoringSearch
from pydov.util.errors import LogReplayError
from pydov.util.hooks import Hooks, RepeatableLogRecorder, RepeatableLogReplayer
from tests.abstract import ServiceCheck


@pytest.fixture()
def temp_directory():
    """PyTest fixture providing a temporary directory that does not exist on
    disk.

    Yields
    ------
    str
        Path to temporary directory that does not exist on disk yet.
    """
    temp_dir = os.path.join(tempfile.gettempdir(), 'pydov-test-repeatable-log')
    if os.path.exists(temp_dir):
        shutil.rmtree(temp_dir)

    yield temp_dir

    if os.path.exists(temp_dir):
        shutil.rmtree(temp_dir, ignore_errors=True)


@pytest.fixture()
def log_recorder(temp_directory):
    """PyTest fixture providing an instance of the RepeatableLogRecorder hook,
    using a temporary directory to store the archive.

    Parameters
    ----------
    temp_directory : pytest.fixture
        Fixture providing a temporary directory.

    Yields
    ------
    RepeatableLogRecorder
        RepeatableLogRecorder hook instance.
    """
    orig_hooks = Hooks(pydov.hooks)
    recorder = RepeatableLogRecorder(temp_directory)
    pydov.hooks = Hooks((recorder,))

    yield recorder
<commit_msg>Ignore errors on fixture setup too.<commit_after>import json
import re
import shutil
import time
import zipfile
import pytest
import tempfile
import os
import pydov

from pydov.search.boring import BoringSearch
from pydov.util.errors import LogReplayError
from pydov.util.hooks import Hooks, RepeatableLogRecorder, RepeatableLogReplayer
from tests.abstract import ServiceCheck


@pytest.fixture()
def temp_directory():
    """PyTest fixture providing a temporary directory that does not exist on
    disk.

    Yields
    ------
    str
        Path to temporary directory that does not exist on disk yet.
    """
    temp_dir = os.path.join(tempfile.gettempdir(), 'pydov-test-repeatable-log')
    if os.path.exists(temp_dir):
        shutil.rmtree(temp_dir, ignore_errors=True)

    yield temp_dir

    if os.path.exists(temp_dir):
        shutil.rmtree(temp_dir, ignore_errors=True)


@pytest.fixture()
def log_recorder(temp_directory):
    """PyTest fixture providing an instance of the RepeatableLogRecorder hook,
    using a temporary directory to store the archive.

    Parameters
    ----------
    temp_directory : pytest.fixture
        Fixture providing a temporary directory.

    Yields
    ------
    RepeatableLogRecorder
        RepeatableLogRecorder hook instance.
    """
    orig_hooks = Hooks(pydov.hooks)
    recorder = RepeatableLogRecorder(temp_directory)
    pydov.hooks = Hooks((recorder,))

    yield recorder

{'fraction_non_alphanumeric': 0.08162544169611308, 'fraction_numerical': 0.0, 'mean_word_length': 3.355384615384615, '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': '4124591', 'n_tokens_mistral': 860, 'n_tokens_neox': 849, 'n_words': 240}