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

import sys, inspect, traceback
from string import capwords

import utilities.cursor as cursor
import utilities.muffler as muffler
import utilities.text as text

# Skip Decorator
# ==============
# Having the ability to skip tests would be useful.  A good way to do this
# would be to add a skip decorator.  The suite would keep track of the tests
# that are being skipped, and the final status would be displayed in yellow
# rather than green.
#
# A related problem is preventing users from simply removing the test
# decorator.  This is a bad practice, because it's very easy to forget to add
# the test back later.  To address this, I should allow users to specify
# exactly how many tests there are.
#
# If there aren't the right number of tests, or if there are no tests, the
# suite will fail.  

# Stop on Failure
# ===============
# Since this framework only reports the results of the first failed test, there
# isn't any point running additional tests after a failure.  This is especially
# annoying when all of the tests are stuck in infinite loops, because you have
# to press ^C several times to get back to the terminal, and when the tests are
# expensive and run slowly.

class Suite:

    def __init__(self, title, stop_on_error=False):
        self.tests = []
        self.results = []

        self.title = title
        self.finished = False

        self.setup_action = lambda helper: None
        self.teardown_action = lambda helper: None

        self.stop_on_error = stop_on_error

    def __iter__(self):
        assert self.finished
        return iter(self.results)<commit_msg>Turn stop_on_error on by default.<commit_after>#!/usr/bin/env python

import sys, inspect, traceback
from string import capwords

import utilities.cursor as cursor
import utilities.muffler as muffler
import utilities.text as text

# Skip Decorator
# ==============
# Having the ability to skip tests would be useful.  A good way to do this
# would be to add a skip decorator.  The suite would keep track of the tests
# that are being skipped, and the final status would be displayed in yellow
# rather than green.
#
# A related problem is preventing users from simply removing the test
# decorator.  This is a bad practice, because it's very easy to forget to add
# the test back later.  To address this, I should allow users to specify
# exactly how many tests there are.
#
# If there aren't the right number of tests, or if there are no tests, the
# suite will fail.  

# Stop on Failure
# ===============
# Since this framework only reports the results of the first failed test, there
# isn't any point running additional tests after a failure.  This is especially
# annoying when all of the tests are stuck in infinite loops, because you have
# to press ^C several times to get back to the terminal, and when the tests are
# expensive and run slowly.

class Suite:

    def __init__(self, title, stop_on_error=True):
        self.tests = []
        self.results = []

        self.title = title
        self.finished = False

        self.setup_action = lambda helper: None
        self.teardown_action = lambda helper: None

        self.stop_on_error = stop_on_error

    def __iter__(self):
        assert self.finished
        return iter(self.results)
{'fraction_non_alphanumeric': 0.07179642532565889, 'fraction_numerical': 0.0, 'mean_word_length': 3.3793103448275863, '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': '42450', 'n_tokens_mistral': 887, 'n_tokens_neox': 851, 'n_words': 447}