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

import unittest

from roushagent import RoushAgent

class TestRoushAgent(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.agent = RoushAgent(["-c", "roush-agent-test.conf"])

    def test_1_input_handler_setup(self):
        self.assertTrue(self.agent.input_handler.input_plugins['input']['state'].input_setup_called)

    def test_2_dispatch(self):
        # Actually run the thing
        self.agent._dispatch(True)

    def test_3_input_handler_fetch(self):
        self.assertTrue(self.agent.input_handler.input_plugins['input']['state'].input_fetch_called)

    def test_4_input_handler_teardown(self):
        # Stop it so teardown occurs
        self.agent.input_handler.stop()
        self.assertTrue(self.agent.input_handler.input_plugins['input']['state'].input_teardown_called)

    def test_5_output_handler_setup(self):
        self.assertTrue(self.agent.output_handler.output_plugins['output']['state'].output_setup_called)

    def test_6_output_handler_handler(self):
        self.assertTrue(self.agent.output_handler.output_plugins['output']['state'].output_handler_called)

    def test_7_output_handler_teardown(self):
        # Stop it so teardown occurs
        self.agent.output_handler.stop()
        self.assertTrue(self.agent.output_handler.output_plugins['output']['state'].output_teardown_called)

if __name__ == '__main__':<commit_msg>Rewrote all the tests to not be interdependent<commit_after>#!/usr/bin/env python

import unittest

from roushagent import RoushAgent

class TestRoushAgent(unittest.TestCase):
    def setUp(self):
        self.agent = RoushAgent(["-c", "roush-agent-test.conf"])
        self.output_handler = self.agent.output_handler
        self.input_handler = self.agent.input_handler
        self.result = self.agent.input_handler.fetch()
        self.result['output'] = self.output_handler.dispatch(self.result['input'])
        self.agent.input_handler.result(self.result)
        self.input_state = self.agent.input_handler.input_plugins['input']['state']
        self.output_state = self.agent.output_handler.output_plugins['output']['state']

    def tearDown(self):
        self.agent._cleanup()

    def test_input_setup(self):
        self.assertTrue(self.input_state.input_setup_called)

    def test_input_fetch(self):
        self.assertTrue(self.input_state.input_fetch_called)

    def test_input_teardown(self):
        # Stop it so teardown occurs
        self.agent.input_handler.stop()
        self.assertTrue(self.input_state.input_teardown_called)

    def test_output_setup(self):
        self.assertTrue(self.output_state.output_setup_called)

    def test_output_handler(self):
        self.assertTrue(self.output_state.output_handler_called)

    def test_output_teardown(self):
        # Stop it so teardown occurs
        self.agent.output_handler.stop()
        self.assertTrue(self.output_state.output_teardown_called)

if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.10980917308336123, 'fraction_numerical': 0.002343488449949782, 'mean_word_length': 4.021848739495798, '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': '3028755', 'n_tokens_mistral': 930, 'n_tokens_neox': 922, 'n_words': 126}