<commit_before>#!/usr/bin/env python

import os
import shutil
import sys
import warnings

from django.core.management import execute_from_command_line
from wagtail.utils.deprecation import RemovedInWagtail27Warning

os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtailmedia.tests.settings'


def runtests():
    # Don't ignore DeprecationWarnings
    only_wagtailmedia = r'^wagtailmedia(\.|$)'
    warnings.filterwarnings('default', category=DeprecationWarning, module=only_wagtailmedia)
    warnings.filterwarnings('default', category=PendingDeprecationWarning, module=only_wagtailmedia)

    args = sys.argv[1:]
    argv = sys.argv[:1] + ['test'] + args
    try:
        # adding an assert to catch RemovedInWagtail27Warning warnings
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            execute_from_command_line(argv)
            for warning in w:
                assert not isinstance(warning.message, RemovedInWagtail27Warning), \
                    'These tests raised a RemovedInWagtail27Warning.'
    finally:
        from wagtailmedia.tests.settings import STATIC_ROOT, MEDIA_ROOT
        shutil.rmtree(STATIC_ROOT, ignore_errors=True)
        shutil.rmtree(MEDIA_ROOT, ignore_errors=True)


if __name__ == '__main__':
    runtests()<commit_msg>Exposing deprecation warning message to failing deprecation tests<commit_after>#!/usr/bin/env python

import os
import shutil
import sys
import warnings

from django.core.management import execute_from_command_line
from wagtail.utils.deprecation import RemovedInWagtail27Warning

os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtailmedia.tests.settings'


def runtests():
    # Don't ignore DeprecationWarnings
    only_wagtailmedia = r'^wagtailmedia(\.|$)'
    warnings.filterwarnings('default', category=DeprecationWarning, module=only_wagtailmedia)
    warnings.filterwarnings('default', category=PendingDeprecationWarning, module=only_wagtailmedia)

    args = sys.argv[1:]
    argv = sys.argv[:1] + ['test'] + args
    try:
        # adding an assert to catch RemovedInWagtail27Warning warnings
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter('always')
            execute_from_command_line(argv)
            for warning in w:
                assert not isinstance(warning.message, RemovedInWagtail27Warning), \
                    f'These tests raised a RemovedInWagtail27Warning. {warning.message}'
    finally:
        from wagtailmedia.tests.settings import STATIC_ROOT, MEDIA_ROOT
        shutil.rmtree(STATIC_ROOT, ignore_errors=True)
        shutil.rmtree(MEDIA_ROOT, ignore_errors=True)


if __name__ == '__main__':
    runtests()
{'fraction_non_alphanumeric': 0.08739308293045742, 'fraction_numerical': 0.007437709185570844, 'mean_word_length': 3.890909090909091, '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': '4170574', 'n_tokens_mistral': 827, 'n_tokens_neox': 808, 'n_words': 167}