Esempio n. 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
Esempio n. 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)
Esempio n. 3
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)
Esempio n. 4
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)
     if options.list_undefined:
         self.undefined_steps = []
     else:
         self.undefined_steps = None
     self.show_step_definitions = options.show_step_definitions
     self._test_class = None
Esempio n. 5
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
Esempio n. 6
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)
        if options.list_undefined:
            self.undefined_steps = []
        else:
            self.undefined_steps = None
        self._test_class = None
        self.dry_run = options.dry_run
        self.parse_strict = False
        if options.parse_strict:
            self.parse_strict = True

        self.test_addresses = None
        if options.use_test_addresses:
            file_name = options.use_test_addresses
            file_name = os.path.expanduser(file_name)
            if not os.path.isabs(file_name):
                file_name = os.path.join(config.workingDir, file_name)
            data = None
            fh = None
            try:
                fh = open(file_name, 'r')
                data = fh.read()
            except:
                pass
            finally:
                if fh is not None and fh: fh.close()

            if data is not None:
                self.test_addresses = []
                for line in data.split("\n"):
                    i = line.strip().rfind(":")
                    if i >= 0:
                        self.test_addresses.append([line[0:i], int(line[i+1:])])
                if not len(self.test_addresses):
                    self.test_addresses = None
                else:
                    log.debug("Test addresses to execute: " + str(self.test_addresses))
Esempio n. 7
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
Esempio n. 8
0
 def setUp(self):
     self.language = load_language('en')
     self.cur_dir = os.path.dirname(os.path.abspath(__file__))
Esempio n. 9
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
Esempio n. 10
0
    sr = StepImplRegistry(TagMatcher)
    for path in paths:
        loader.load_steps_impl(sr, path)
    return sr

def load_features(paths, language):
    result = []
    for path in paths:
        for (dirpath, dirnames, filenames) in os.walk(path):
            for feature_file in filenames:
                if feature_file.endswith(".feature"):
                    feature_file = os.path.join(dirpath, feature_file)
                    result.append(load_feature(feature_file, language))
    return result

if __name__ == "__main__":
    import sys
    import logging
    from freshen.handlers import ConsoleHandler
    
    logging.basicConfig(level=logging.DEBUG)
    
    paths = sys.argv[1:] or ["features"]
    
    language = load_language('en')
    registry = load_step_definitions(paths)
    features = load_features(paths, language)
    handler = FreshenHandlerProxy([ConsoleHandler()])
    run_features(registry, features, handler)

 def setUp(self):
     self.language = load_language('bg')
Esempio n. 12
0
    for path in paths:
        loader.load_steps_impl(sr, path)
    return sr


def load_features(paths, language):
    result = []
    for path in paths:
        for (dirpath, dirnames, filenames) in os.walk(path):
            for feature_file in filenames:
                if feature_file.endswith(".feature"):
                    feature_file = os.path.join(dirpath, feature_file)
                    result.append(load_feature(feature_file, language))
    return result


if __name__ == "__main__":
    import sys
    import logging
    from freshen.handlers import ConsoleHandler

    logging.basicConfig(level=logging.DEBUG)

    paths = sys.argv[1:] or ["features"]

    language = load_language('en')
    registry = load_step_definitions(paths)
    features = load_features(paths, language)
    handler = FreshenHandlerProxy([ConsoleHandler()])
    run_features(registry, features, handler)