<commit_before>#!/usr/bin/env python
import sys
sys.path.append('lib/sdks/google_appengine_1.7.1/google_appengine')

import dev_appserver
import unittest

dev_appserver.fix_sys_path()

suites = unittest.loader.TestLoader().discover("src/givabit", pattern="*_test.py")

if len(sys.argv) > 1:
    def GetTestCases(caseorsuite, acc=None):
        if acc is None:
            acc = []
        if isinstance(caseorsuite, unittest.TestCase):
            acc.append(caseorsuite)
            return acc
        for child in caseorsuite:
            GetTestCases(child, acc)
        return acc
    all_tests = GetTestCases(suites)
    tests = [test for test in all_tests if test.id() == sys.argv[1]]
    suites = unittest.TestSuite(tests)

unittest.TextTestRunner(verbosity=1).run(suites)<commit_msg>Allowing single test packages to be run<commit_after>#!/usr/bin/env python
import sys
sys.path.append('lib/sdks/google_appengine_1.7.1/google_appengine')

import dev_appserver
import unittest

dev_appserver.fix_sys_path()

suites = unittest.loader.TestLoader().discover("src/givabit", pattern="*_test.py")

if len(sys.argv) > 1:
    def GetTestCases(caseorsuite, acc=None):
        if acc is None:
            acc = []
        if isinstance(caseorsuite, unittest.TestCase):
            acc.append(caseorsuite)
            return acc
        for child in caseorsuite:
            GetTestCases(child, acc)
        return acc
    all_tests = GetTestCases(suites)
    tests = [test for test in all_tests if test.id().startswith(sys.argv[1])]
    suites = unittest.TestSuite(tests)

unittest.TextTestRunner(verbosity=1).run(suites)
{'fraction_non_alphanumeric': 0.11193568336425479, 'fraction_numerical': 0.0074211502782931356, 'mean_word_length': 3.3262032085561497, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6147068', 'n_tokens_mistral': 552, 'n_tokens_neox': 544, 'n_words': 108}