Example #1
0
def load_file(filepath):
    feature = load_feature(filepath, load_language(LANGUAGE))
    registry = StepImplRegistry(TagMatcher)
    loader = StepImplLoader()
    loader.load_steps_impl(registry, os.path.dirname(feature.src_file),
                           feature.use_step_defs)
    return registry
Example #2
0
 def configure(self, options, config):
     super(FreshenNosePlugin, self).configure(options, config)
     all_tags = options.tags.split(",") if options.tags else []
     self.tagmatcher = TagMatcher(all_tags)
     self.language = load_language(options.language)
     self.impl_loader = StepImplLoader()
     if not self.language:
         print >> sys.stderr, "Error: language '%s' not available" % options.language
         exit(1)
Example #3
0
def load_dir(dirpath):
    registry = StepImplRegistry(TagMatcher)
    loader = StepImplLoader()

    def walktree(top, filter_func=lambda x: True):
        names = os.listdir(top)
        for name in names:
            path = os.path.join(top, name)
            if filter_func(path):
                yield path
            if os.path.isdir(path):
                for i in walktree(path, filter_func):
                    yield i

    for feature_file in walktree(dirpath, lambda x: x.endswith('.feature')):
        feature = load_feature(feature_file, load_language(LANGUAGE))
        loader.load_steps_impl(registry, os.path.dirname(feature.src_file),
                               feature.use_step_defs)
    return registry
Example #4
0
def load_step_definitions(paths):
    loader = StepImplLoader()
    sr = StepImplRegistry(TagMatcher)
    for path in paths:
        loader.load_steps_impl(sr, path)
    return sr