<commit_before>""" basic test session implementation. 

* drives collection of tests 
* triggers executions of tests   
* produces events used by reporting 
"""

import py

# exitcodes for the command line
EXIT_OK = 0
EXIT_TESTSFAILED = 1
EXIT_INTERRUPTED = 2
EXIT_INTERNALERROR = 3
EXIT_NOHOSTS = 4

# imports used for genitems()
Item = py.test.collect.Item
Collector = py.test.collect.Collector

class Session(object): 
    nodeid = ""
    class Interrupted(KeyboardInterrupt):
        """ signals an interrupted test run. """
        
    def __init__(self, config):
        self.config = config
        self.pluginmanager = config.pluginmanager # shortcut 
        self.pluginmanager.register(self)
        self._testsfailed = 0
        self._nomatch = False
        self.shouldstop = False

    def genitems(self, colitems, keywordexpr=None):
        """ yield Items from iterating over the given colitems. """
        if colitems:
            colitems = list(colitems)
        while colitems: <commit_msg>fix for py3 exception printing logic<commit_after>""" basic test session implementation. 

* drives collection of tests 
* triggers executions of tests   
* produces events used by reporting 
"""

import py

# exitcodes for the command line
EXIT_OK = 0
EXIT_TESTSFAILED = 1
EXIT_INTERRUPTED = 2
EXIT_INTERNALERROR = 3
EXIT_NOHOSTS = 4

# imports used for genitems()
Item = py.test.collect.Item
Collector = py.test.collect.Collector

class Session(object): 
    nodeid = ""
    class Interrupted(KeyboardInterrupt):
        """ signals an interrupted test run. """
        __module__ = 'builtins' # for py3
        
    def __init__(self, config):
        self.config = config
        self.pluginmanager = config.pluginmanager # shortcut 
        self.pluginmanager.register(self)
        self._testsfailed = 0
        self._nomatch = False
        self.shouldstop = False

    def genitems(self, colitems, keywordexpr=None):
        """ yield Items from iterating over the given colitems. """
        if colitems:
            colitems = list(colitems)
        while colitems: 
{'fraction_non_alphanumeric': 0.08241494968854815, 'fraction_numerical': 0.006708193579300431, 'mean_word_length': 2.8666666666666667, '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': '3699424', 'n_tokens_mistral': 608, 'n_tokens_neox': 591, 'n_words': 181}