Exemple #1
0
    def __init__(self):
        set_defaults(self, 'backtrace', 'color_scheme', 'source', 'multiline', 'snippets', 'strict')
        self.__out = ColoredOutput(sys.stdout)
        self.__real_out = self.__out

        self.silent_steps = False
        self.current_feature = None
        self.talign = string.ljust

        # Indents.
        self.scenario_indent = 2
        self.step_indent = 4
        self.multiline_indent = 6
        self.traceback_indent = 6
        self.source_indent = 0  # will be recalculated for each scenario

        # Statistics.
        self.counts = collections.defaultdict(int)
        
        # Deferred output.
        self.feature_header = None
        self.scenario_outline_header = None

        # Scenario formatter by default.
        self.scenario = self.__default_scenario_formatter
        
        # Set of undefined steps.
        self.undefined = dict()
 def test_004_multiple(self):
     set_defaults(self.a, 'scenario_names', 'guess')
     self.assertEqual(self.a.scenario_names, [])
     self.assertEqual(self.a.guess, None)
     del(self.a.scenario_names)
     del(self.a.guess)
     self.assertEqual(dir(self.a), dir(A()))
    def __init__(self):
        # Options.
        set_defaults(self, 'path', 'excludes', 'require', 'guess', 'verbose', 'dry_run', 'strict')
        
        self.skip_steps = self.dry_run
        
        # Special objects:
        self.__pending = Pending()
        self.__multi = Value(type='multi')
        self.__callback = lambda x: Value(value=x, type='callback')
        self.__world = ObjectsSpace()
        self.__universe = ObjectsSpace()
        
        # Castings.
        self.__castings = {}

        # Create mappings, decorators and runners for step definitions.
        self.__step_definitions = {}
        
        for kw in _STEP_KEYWORDS:
            deco_name = kw.capitalize()
            setattr(self, deco_name, self.__add_rule)
            self.__pending._set_sub_decorator(deco_name, self.__add_rule)
            setattr(self, kw, self.__find_match)
        
        # Create multiplexers and decorators for hooks.
        for hook in _HOOKS:
            setattr(self, hook, Multiplexer())
            setattr(self, hook.capitalize(), partial(self.__add_hook, getattr(self, hook)))
Exemple #4
0
    def __init__(self):
        set_defaults(self, 'backtrace', 'color_scheme', 'source', 'multiline', 'snippets', 'strict')
        self.__out = ColoredOutput(sys.stdout)

        # Statistics.
        self.counts = collections.defaultdict(int)

        # Set of undefined steps.
        self.undefined = dict()
        
        self.chars = {
            'passed': self.color_scheme.passed('.'),
            'failed': self.color_scheme.failed('F'),
            'undefined': self.color_scheme.undefined('U'),
            'pending': self.color_scheme.pending('P'),
            'skipped': self.color_scheme.skipped('-'),
        }
 def test_002_one_single(self):
     set_defaults(self.a, 'guess')
     self.assertEqual(self.a.guess, None)
     del(self.a.guess)
     self.assertEqual(dir(self.a), dir(A()))
 def test_001_one_accu(self):
     set_defaults(self.a, 'scenario_names')
     self.assertEqual(self.a.scenario_names, [])
     del(self.a.scenario_names)
     self.assertEqual(dir(self.a), dir(A()))
 def test_000_nothing(self):
     set_defaults(self.a)
     self.assertEqual(dir(self.a), dir(A()))
Exemple #8
0
 def __init__(self):
     set_defaults(self, 'scenario_names', 'tags')
     self.status = None
Exemple #9
0
 def __init__(self):
     set_defaults(self, 'path', 'excludes')
     self.__current_language = None
     self.__parser = FeatureParser()