<commit_before>import os
import sys

import pytest


# This is a hack to fix path problems because "borg" (the package) is in the source root.
# When importing the conftest an "import borg" can incorrectly import the borg from the
# source root instead of the one installed in the environment.
# The workaround is to remove entries pointing there from the path and check whether "borg"
# is still importable. If it is not, then it has not been installed in the environment
# and the entries are put back.
#
# TODO: After moving the package to src/: remove this.

original_path = list(sys.path)
for entry in original_path:
    if entry == '' or entry.endswith('/borg'):
        sys.path.remove(entry)

try:
    import borg
except ImportError:
    sys.path = original_path


@pytest.fixture(autouse=True)
def clean_env(tmpdir_factory, monkeypatch):<commit_msg>fix tox build for environment-python != containing-python in yet-another instance<commit_after>import os
import os.path
import sys

import pytest


# This is a hack to fix path problems because "borg" (the package) is in the source root.
# When importing the conftest an "import borg" can incorrectly import the borg from the
# source root instead of the one installed in the environment.
# The workaround is to remove entries pointing there from the path and check whether "borg"
# is still importable. If it is not, then it has not been installed in the environment
# and the entries are put back.

original_path = list(sys.path)
for entry in original_path:
    if entry == '' or entry == os.path.dirname(__file__):
        sys.path.remove(entry)

try:
    import borg
except ImportError:
    sys.path = original_path


@pytest.fixture(autouse=True)
def clean_env(tmpdir_factory, monkeypatch):
{'fraction_non_alphanumeric': 0.06959498003422704, 'fraction_numerical': 0.0, 'mean_word_length': 4.204747774480712, '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': '7094106', 'n_tokens_mistral': 502, 'n_tokens_neox': 489, 'n_words': 231}