<commit_before># -*- coding: utf-8  -*-
"""Package tests."""
#
# (C) Pywikibot team, 2007-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals

__version__ = '$Id$'

import functools
import os
import warnings

__all__ = ('requests', 'TestRequest',
           'patch_request', 'unpatch_request')

# Verify that the unit tests have a base working environment:
# - requests is mandatory
# - future is needed as a fallback for python 2.6,
#   however if unavailable this will fail on use; see pywikibot/tools.py
# - unittest2; see below
# - mwparserfromhell is optional, so is only imported in textlib_tests
import requests  # noqa

from pywikibot.tools import PYTHON_VERSION

if PYTHON_VERSION < (2, 7, 3):
    # unittest2 is a backport of python 2.7s unittest module to python 2.6
    # Also use unittest2 for python 2.7.2 (T106512)
    import unittest2 as unittest
else:
    import unittest

import pywikibot.data.api

from pywikibot import config
from pywikibot import i18n
from pywikibot.data.api import Request as _original_Request
from pywikibot.data.api import CachedRequest

_root_dir = os.path.split(os.path.split(__file__)[0])[0]


def join_root_path(*names):
    """Return a path relative to the root directory."""
    return os.path.join(_root_dir, *names)


def create_path_func(base_func, subpath):
    """Return a function returning a path relative to the given directory."""
    func = functools.partial(base_func, subpath)
    func.path = base_func.path + '/' + subpath
    func.__doc__ = 'Return a path relative to `{0}/`.'.format(func.path)
    return func


join_root_path.path = 'root'
join_tests_path = create_path_func(join_root_path, 'tests')
join_cache_path = create_path_func(join_tests_path, 'apicache')
join_data_path = create_path_func(join_tests_path, 'data')
join_pages_path = create_path_func(join_tests_path, 'pages')

join_images_path = create_path_func(join_data_path, 'images')
join_xml_data_path = create_path_func(join_data_path, 'xml')

# Find the root directory of the checkout
_pwb_py = join_root_path('pwb.py')

library_test_modules = [
    'python',
    'deprecation',
    'ui',
    'ui_options',
    'thread',<commit_msg>Add Python version to test apicache directory name<commit_after># -*- coding: utf-8  -*-
"""Package tests."""
#
# (C) Pywikibot team, 2007-2014
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals

__version__ = '$Id$'

import functools
import os
import warnings

__all__ = ('requests', 'TestRequest',
           'patch_request', 'unpatch_request')

# Verify that the unit tests have a base working environment:
# - requests is mandatory
# - future is needed as a fallback for python 2.6,
#   however if unavailable this will fail on use; see pywikibot/tools.py
# - unittest2; see below
# - mwparserfromhell is optional, so is only imported in textlib_tests
import requests  # noqa

from pywikibot.tools import PYTHON_VERSION

if PYTHON_VERSION < (2, 7, 3):
    # unittest2 is a backport of python 2.7s unittest module to python 2.6
    # Also use unittest2 for python 2.7.2 (T106512)
    import unittest2 as unittest
else:
    import unittest

import pywikibot.data.api

from pywikibot import config
from pywikibot import i18n
from pywikibot.data.api import Request as _original_Request
from pywikibot.data.api import CachedRequest

_root_dir = os.path.split(os.path.split(__file__)[0])[0]


def join_root_path(*names):
    """Return a path relative to the root directory."""
    return os.path.join(_root_dir, *names)


def create_path_func(base_func, subpath):
    """Return a function returning a path relative to the given directory."""
    func = functools.partial(base_func, subpath)
    func.path = base_func.path + '/' + subpath
    func.__doc__ = 'Return a path relative to `{0}/`.'.format(func.path)
    return func


join_root_path.path = 'root'
join_tests_path = create_path_func(join_root_path, 'tests')
join_cache_path = create_path_func(join_tests_path,
                                   'apicache-py%d' % PYTHON_VERSION[0])
join_data_path = create_path_func(join_tests_path, 'data')
join_pages_path = create_path_func(join_tests_path, 'pages')

join_images_path = create_path_func(join_data_path, 'images')
join_xml_data_path = create_path_func(join_data_path, 'xml')

# Find the root directory of the checkout
_pwb_py = join_root_path('pwb.py')

library_test_modules = [
    'python',
    'deprecation',
    'ui',
    'ui_options',
    'thread',
{'fraction_non_alphanumeric': 0.09874642621508688, 'fraction_numerical': 0.016054541455904993, 'mean_word_length': 4.401425178147268, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2711037', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1514, 'n_words': 439}