<commit_before>import unittest
import subprocess
import shlex
from subprocess import Popen, PIPE
import os
import sys


class TestWaitForIt(unittest.TestCase):

    
    def execute(self,cmd):
        """Executes a command and returns exit code, STDOUT, STDERR"""
        args = shlex.split(cmd)
        proc = Popen(args, stdout=PIPE, stderr=PIPE)
        out, err = proc.communicate()
        exitcode = proc.returncode
        return exitcode, out, err
    
    def setUp(self):
        script_path = os.path.dirname(sys.argv[0])
        parent_path = os.path.abspath(os.path.join(script_path, os.pardir))
        self.wait_script = os.path.join(parent_path,"wait-for-it.sh")

    def test_no_args_return_code(self):
        # Return code should be 1 when called with no args
        exitcode, out, err = self.execute(self.wait_script)
        self.assertEqual(exitcode,1)        
        
    def test_help(self):
        exitcode, out, err = self.execute(self.wait_script+" --help")
        # STDERR should begin with "Usage:"
        self.assertTrue(err.startswith("Usage:"))
        # exit code should be 1
        self.assertEqual(exitcode,1)



if __name__ == '__main__':
    unittest.main()
<commit_msg>Start of test framework<commit_after>import unittest
import subprocess
import shlex
from subprocess import Popen, PIPE
import os
import sys


class TestWaitForIt(unittest.TestCase):

    
    def execute(self,cmd):
        """Executes a command and returns exit code, STDOUT, STDERR"""
        args = shlex.split(cmd)
        proc = Popen(args, stdout=PIPE, stderr=PIPE)
        out, err = proc.communicate()
        exitcode = proc.returncode
        return exitcode, out, err
    
    def setUp(self):
        script_path = os.path.dirname(sys.argv[0])
        parent_path = os.path.abspath(os.path.join(script_path, os.pardir))
        self.wait_script = os.path.join(parent_path,"wait-for-it.sh")

    def test_no_args_return_code(self):
        # Return code should be 1 when called with no args
        exitcode, out, err = self.execute(self.wait_script)
        self.assertEqual(exitcode,1)        
        
    def test_help(self):
        # Execute with "--help" option and check output
        exitcode, out, err = self.execute(self.wait_script+" --help")
        # STDERR should begin with "Usage:"
        self.assertTrue(err.startswith("Usage:"))
        # exit code should be 1
        self.assertEqual(exitcode,1)



if __name__ == '__main__':
    unittest.main()

{'fraction_non_alphanumeric': 0.10634028892455859, 'fraction_numerical': 0.0040128410914927765, 'mean_word_length': 2.7208955223880595, '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': '2715683', 'n_tokens_mistral': 795, 'n_tokens_neox': 780, 'n_words': 194}