<commit_before># This test is a bit unique because it's in the MPF-MC package but it runs on
# the MPF side of things, and therefore it uses MPF's test case instead of
# MPF-MC's.

import logging
import os
import time
from mock import *

import mpfmc
from mpf.core.config_player import ConfigPlayer
from mpf.tests.MpfTestCase import MpfTestCase, TestMachineController
import mpf.core
from mpf.core.config_validator import ConfigValidator


class TestMpfPluginConfigPlayerValidation(MpfTestCase):

    # todo maybe make a base class to run MPF tests from MPFMC?
    # see comments for changes from base class

    def setUp(self):
        # we want to reuse config_specs to speed tests up
        ConfigValidator.unload_config_spec = MagicMock()

        self._events = {}

        # print(threading.active_count())

        self.test_start_time = time.time()
        if self.unittest_verbosity() > 1:
            logging.basicConfig(level=logging.DEBUG,
                                format='%(asctime)s : %(levelname)s : %('
                                       'name)s : %(message)s')
        else:
            # no logging by default
            logging.basicConfig(level=99)

        self.save_and_prepare_sys_path()

        # init machine
        machine_path = os.path.abspath(os.path.join(
            mpfmc.__path__[0], os.pardir, 'mpfmc', self.getMachinePath()))

        self._mock_data_manager()

        try:
            # Note the 'True' for enabling plugins, change from base
            self.machine = TestMachineController(
                os.path.abspath(os.path.join(
                    mpf.core.__path__[0], os.pardir)), machine_path,
                self.getOptions(),
                self.machine_config_patches, True)
            self.realTime = self.machine.clock.time
            self.testTime = self.realTime()
            self.machine.clock.time = MagicMock(return_value=self.testTime)

            self.machine.default_platform.timer_initialize()
            self.machine.loop_start_time = self.machine.clock.get_time()

            while not self.machine.test_init_complete:
                self.advance_time_and_run(0.01)

            self.machine.ball_controller.num_balls_known = 99
            self.advance_time_and_run(300)

        except Exception as e:
            # todo temp until I can figure out how to stop the asset loader
            # thread automatically.
            try:
                self.machine.stop()
            except AttributeError:
                pass
            raise e

        self.patch_bcp()  # change from base

    def getConfigFile(self):
        return 'mpf_plugin_validation.yaml'

    def getMachinePath(self):
        return 'tests/machine_files/mpf_plugin_config_player_validation/'

    def test_slides_validation_shows(self):

        # for step in self.machine.shows['show1'].show_steps:<commit_msg>remove dead variable from test<commit_after># This test is a bit unique because it's in the MPF-MC package but it runs on
# the MPF side of things, and therefore it uses MPF's test case instead of
# MPF-MC's.

import logging
import os
import time
from mock import *

import mpfmc
from mpf.core.config_player import ConfigPlayer
from mpf.tests.MpfTestCase import MpfTestCase, TestMachineController
import mpf.core
from mpf.core.config_validator import ConfigValidator


class TestMpfPluginConfigPlayerValidation(MpfTestCase):

    # todo maybe make a base class to run MPF tests from MPFMC?
    # see comments for changes from base class

    def setUp(self):
        # we want to reuse config_specs to speed tests up
        ConfigValidator.unload_config_spec = MagicMock()

        self._events = {}

        # print(threading.active_count())

        self.test_start_time = time.time()
        if self.unittest_verbosity() > 1:
            logging.basicConfig(level=logging.DEBUG,
                                format='%(asctime)s : %(levelname)s : %('
                                       'name)s : %(message)s')
        else:
            # no logging by default
            logging.basicConfig(level=99)

        self.save_and_prepare_sys_path()

        # init machine
        machine_path = os.path.abspath(os.path.join(
            mpfmc.__path__[0], os.pardir, 'mpfmc', self.getMachinePath()))

        self._mock_data_manager()

        try:
            # Note the 'True' for enabling plugins, change from base
            self.machine = TestMachineController(
                os.path.abspath(os.path.join(
                    mpf.core.__path__[0], os.pardir)), machine_path,
                self.getOptions(),
                self.machine_config_patches, True)
            self.realTime = self.machine.clock.time
            self.testTime = self.realTime()
            self.machine.clock.time = MagicMock(return_value=self.testTime)

            self.machine.default_platform.timer_initialize()

            while not self.machine.test_init_complete:
                self.advance_time_and_run(0.01)

            self.machine.ball_controller.num_balls_known = 99
            self.advance_time_and_run(300)

        except Exception as e:
            # todo temp until I can figure out how to stop the asset loader
            # thread automatically.
            try:
                self.machine.stop()
            except AttributeError:
                pass
            raise e

        self.patch_bcp()  # change from base

    def getConfigFile(self):
        return 'mpf_plugin_validation.yaml'

    def getMachinePath(self):
        return 'tests/machine_files/mpf_plugin_config_player_validation/'

    def test_slides_validation_shows(self):

        # for step in self.machine.shows['show1'].show_steps:
{'fraction_non_alphanumeric': 0.07994389901823282, 'fraction_numerical': 0.004908835904628331, 'mean_word_length': 2.192501398992725, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4327222', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1566, 'n_words': 399}