<commit_before>"""
Base classes and utilities for Nikola tests.

Alongside a contextmanager to switch directories this module contains
a Site substitute for rendering tests.
"""

import os
from contextlib import contextmanager

import logbook

import nikola.utils
import nikola.shortcodes

from yapsy.PluginManager import PluginManager
from nikola.plugin_categories import (
    Command,
    Task,
    LateTask,
    TemplateSystem,
    PageCompiler,
    TaskMultiplier,
    CompilerExtension,
    MarkdownExtension,
    RestExtension
)

__all__ = ["cd", "FakeSite"]

nikola.utils.LOGGER.handlers.append(logbook.TestHandler())


@contextmanager
def cd(path):<commit_msg>Move external deps before the app we want to test.<commit_after>"""
Base classes and utilities for Nikola tests.

Alongside a contextmanager to switch directories this module contains
a Site substitute for rendering tests.
"""

import os
from contextlib import contextmanager

import logbook
from yapsy.PluginManager import PluginManager

import nikola.utils
import nikola.shortcodes
from nikola.plugin_categories import (
    Command,
    Task,
    LateTask,
    TemplateSystem,
    PageCompiler,
    TaskMultiplier,
    CompilerExtension,
    MarkdownExtension,
    RestExtension
)

__all__ = ["cd", "FakeSite"]

nikola.utils.LOGGER.handlers.append(logbook.TestHandler())


@contextmanager
def cd(path):
{'fraction_non_alphanumeric': 0.06768558951965066, 'fraction_numerical': 0.0, 'mean_word_length': 4.635245901639344, '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': '1492048', 'n_tokens_mistral': 398, 'n_tokens_neox': 389, 'n_words': 124}