<commit_before>from __future__ import print_function, absolute_import, unicode_literals, division

from alppaca.main import run_scheduler_and_webserver
from alppaca.server_mock import MockIms
from alppaca.compat import unittest
from multiprocessing import Process
import requests
import time
import sys


DEFAULT_TEST_CONFIG = {
    'ims_host': '127.0.0.1',
    'ims_port': 8080,
    'ims_protocol': 'http',
    'bind_ip': '127.0.0.1',
    'bind_port': 25772,
}


class AlppacaIntegrationTest(object):
    def __init__(self, config):
        self.config = config
        self.mock_job = Process(target=self.run_api_server_mock)
        self.alppaca_job = Process(target=self.run_alppaca)

    def __enter__(self):
        self.mock_job.start()
        self.alppaca_job.start()
        return self

    def __exit__(self, *args):
        self.mock_job.terminate()
        self.alppaca_job.terminate()

    def run_alppaca(self):<commit_msg>Log to STDOUT when running integration tests<commit_after>from __future__ import print_function, absolute_import, division

from alppaca.main import run_scheduler_and_webserver
from alppaca.server_mock import MockIms
from alppaca.compat import unittest
from multiprocessing import Process
import requests
import time
import sys


DEFAULT_TEST_CONFIG = {
    'ims_host': '127.0.0.1',
    'ims_port': 8080,
    'ims_protocol': 'http',
    'bind_ip': '127.0.0.1',
    'bind_port': 25772,
    'logging_handler': {
        'module': 'logging',
        'class': 'StreamHandler',
        'args': [],
        'kwargs': {}
    }
}


class AlppacaIntegrationTest(object):
    def __init__(self, config):
        self.config = config
        self.mock_job = Process(target=self.run_api_server_mock)
        self.alppaca_job = Process(target=self.run_alppaca)

    def __enter__(self):
        self.mock_job.start()
        self.alppaca_job.start()
        return self

    def __exit__(self, *args):
        self.mock_job.terminate()
        self.alppaca_job.terminate()

    def run_alppaca(self):
{'fraction_non_alphanumeric': 0.10414610069101678, 'fraction_numerical': 0.02073050345508391, 'mean_word_length': 3.454945054945055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, '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': '5627305', 'n_tokens_mistral': 699, 'n_tokens_neox': 666, 'n_words': 139}