<commit_before>from __future__ import unicode_literals
'''
Collection of fixtures for pytests.

.. note::
    Coverage for this file gives a lot of misses, just like calling coverage from module's main.
'''
import faulthandler
import os
import pytest



#===================================================================================================
# pytest_sessionstart
#===================================================================================================
def pytest_sessionstart(session):
    '''
    pytest hook called before each session begins (including on each slave when running in xdist).

    We use this hook in order to configure global settings that should be set for all tests in our
    runs.
    '''
    from ben10.foundation.is_frozen import SetIsDevelopment
    import sys

    if sys.platform.startswith('win'):
        # Makes the sysmte hide the Windows Error Reporting dialog.
        # http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
        import ctypes
        SEM_NOGPFAULTERRORBOX = 0x0002
        ctypes.windll.kernel32.SetErrorMode(SEM_NOGPFAULTERRORBOX)

    # Enable development-only checks
    SetIsDevelopment(True)


#===================================================================================================
# pytest_runtest_protocol
#===================================================================================================
def pytest_runtest_protocol(item, __multicall__):
    '''
    pytest hook that implements the full test run protocol, setup/call/teardown.

    - faulthandler: we enable a fault handler in the current process, which will stream crash errors
        to a file in the directory configured by the "--fault-handler-dir" command-line option.
        The file is named based on the module and test name, for example:
            "~/ben10._tests.pytest_fixtures.testFaultHandler.txt"

        Since this file is only useful if a a test crashes, it is removed during tear down if
        no crash occurred.
    '''
    name = '%s.%s.txt'  % (item.module.__name__, item.name)
    invalid_chars = [os.sep, os.pathsep, ':', '<', '>', '@']
    if os.altsep:<commit_msg>Skipping non-python test items<commit_after>'''
Collection of fixtures for pytests.

.. note::
    Coverage for this file gives a lot of misses, just like calling coverage from module's main.
'''
from __future__ import unicode_literals
import faulthandler
import os
import pytest



#===================================================================================================
# pytest_sessionstart
#===================================================================================================
def pytest_sessionstart(session):
    '''
    pytest hook called before each session begins (including on each slave when running in xdist).

    We use this hook in order to configure global settings that should be set for all tests in our
    runs.
    '''
    from ben10.foundation.is_frozen import SetIsDevelopment
    import sys

    if sys.platform.startswith('win'):
        # Makes the sysmte hide the Windows Error Reporting dialog.
        # http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621%28v=vs.85%29.aspx
        import ctypes
        SEM_NOGPFAULTERRORBOX = 0x0002
        ctypes.windll.kernel32.SetErrorMode(SEM_NOGPFAULTERRORBOX)

    # Enable development-only checks
    SetIsDevelopment(True)


#===================================================================================================
# pytest_runtest_protocol
#===================================================================================================
def pytest_runtest_protocol(item, __multicall__):
    '''
    pytest hook that implements the full test run protocol, setup/call/teardown.

    - faulthandler: we enable a fault handler in the current process, which will stream crash errors
        to a file in the directory configured by the "--fault-handler-dir" command-line option.
        The file is named based on the module and test name, for example:
            "~/ben10._tests.pytest_fixtures.testFaultHandler.txt"

        Since this file is only useful if a a test crashes, it is removed during tear down if
        no crash occurred.
    '''
    # skip items that are not python test items (for example: pytest)
    if not hasattr(item, 'module'):
        return
    name = '%s.%s.txt'  % (item.module.__name__, item.name)
    invalid_chars = [os.sep, os.pathsep, ':', '<', '>', '@']
    if os.altsep:
{'fraction_non_alphanumeric': 0.24336870026525198, 'fraction_numerical': 0.010167992926613616, 'mean_word_length': 4.0957207207207205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199246', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1135, 'n_words': 383}