<commit_before># -*- coding: utf-8 -*-
# (c) 2020-2021 <NAME> <<EMAIL>>
"""
# conftest.py: sharing fixture functions
https://docs.pytest.org/en/latest/fixture.html#conftest-py-sharing-fixture-functions
"""
import pytest
import logging

import pytest_twisted

from kotori import KotoriBootloader
from test.util import boot_kotori
from test.settings.mqttkit import influx_sensors, influx_events, grafana

logger = logging.getLogger(__name__)


# Disable ellipsis truncation
# https://stackoverflow.com/questions/19171554/preventing-truncation-of-long-strings-in-pytest/60321834#60321834
#from _pytest.assertion import truncate
#truncate.DEFAULT_MAX_LINES = 9999
#truncate.DEFAULT_MAX_CHARS = 9999


def create_machinery(config, scope="package"):

    @pytest_twisted.inlineCallbacks
    @pytest.fixture(scope=scope)
    def machinery():

        # Invoke the machinery.
        logger.info('Spinning up machinery')

        #result = yield threads.deferToThread(boot_kotori)
        result = boot_kotori(config)
        assert isinstance(result, KotoriBootloader)

        #pytest_twisted.blockon(result)

        logger.info('Machinery is almost ready')
        yield result

    return machinery


machinery = create_machinery('./etc/test/main.ini')
create_influxdb = influx_sensors.make_create_db()
reset_influxdb = influx_sensors.make_reset_measurement()
reset_grafana = grafana.make_reset()

reset_influxdb_events = influx_events.make_reset_measurement()<commit_msg>Test: Try to run the `machinery` fixture without `@inlineCallbacks`<commit_after># -*- coding: utf-8 -*-
# (c) 2020-2021 <NAME> <<EMAIL>>
"""
# conftest.py: sharing fixture functions
https://docs.pytest.org/en/latest/fixture.html#conftest-py-sharing-fixture-functions
"""
import pytest
import logging

import pytest_twisted

from kotori import KotoriBootloader
from test.util import boot_kotori
from test.settings.mqttkit import influx_sensors, influx_events, grafana

logger = logging.getLogger(__name__)


# Disable ellipsis truncation
# https://stackoverflow.com/questions/19171554/preventing-truncation-of-long-strings-in-pytest/60321834#60321834
#from _pytest.assertion import truncate
#truncate.DEFAULT_MAX_LINES = 9999
#truncate.DEFAULT_MAX_CHARS = 9999


def create_machinery(config, scope="package"):

    #@pytest_twisted.inlineCallbacks
    @pytest.fixture(scope=scope)
    def machinery():

        # Invoke the machinery.
        logger.info('Spinning up machinery')

        #result = yield threads.deferToThread(boot_kotori)
        result = boot_kotori(config)
        assert isinstance(result, KotoriBootloader)

        #pytest_twisted.blockon(result)

        logger.info('Machinery is almost ready')
        yield result

    return machinery


machinery = create_machinery('./etc/test/main.ini')
create_influxdb = influx_sensors.make_create_db()
reset_influxdb = influx_sensors.make_reset_measurement()
reset_grafana = grafana.make_reset()

reset_influxdb_events = influx_events.make_reset_measurement()
{'fraction_non_alphanumeric': 0.10190444370197127, 'fraction_numerical': 0.0273972602739726, 'mean_word_length': 4.76878612716763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '4393072', 'n_tokens_mistral': 1056, 'n_tokens_neox': 971, 'n_words': 179}