Пример #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
Пример #2
0
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
Пример #3
0
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
Пример #4
0
    def loadTestsFromFile(self, filename, indexes=[]):
        log.debug("Loading from file %s" % filename)

        step_registry = StepImplRegistry(TagMatcher)
        try:
            feat = load_feature(filename, self.language)
            path = os.path.dirname(filename)
        except ParseException, e:
            _, _, tb = sys.exc_info()
            yield ParseFailure(e, tb, filename)
            return
Пример #5
0
    def loadTestsFromFile(self, filename, indexes=[]):
        log.debug("Loading from file %s" % filename)

        step_registry = StepImplRegistry(TagMatcher)
        try:
            feat = load_feature(filename, self.language)
            path = os.path.dirname(filename)
        except ParseException, e:
            _, _, tb = sys.exc_info()
            yield ParseFailure(e, tb, filename)
            return
Пример #6
0
 def loadTestsFromFile(self, filename, indexes=[]):
     log.debug("Loading from file %s" % filename)
     
     step_registry = StepImplRegistry(TagMatcher)
     try:
         feat = load_feature(filename, self.language)
         path = os.path.dirname(filename)
         self.impl_loader.load_steps_impl(step_registry, path, feat.use_step_defs)
     except ParseException, e:
         ec, ev, tb = sys.exc_info()
         yield Failure(ParseException, ParseException(e.pstr, e.loc, e.msg + " in %s" % filename), tb)
         return
Пример #7
0
    def loadTestsFromFile(self, filename, indexes=[]):
        log.debug("Loading from file %s" % filename)

        step_registry = StepImplRegistry(TagMatcher)
        try:
            feat = load_feature(filename, self.language)
            path = os.path.dirname(filename)
            self.impl_loader.load_steps_impl(step_registry, path,
                                             feat.use_step_defs)
        except ParseException, e:
            ec, ev, tb = sys.exc_info()
            yield Failure(
                ParseException,
                ParseException(e.pstr, e.loc, e.msg + " in %s" % filename), tb)
            return
Пример #8
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
Пример #9
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
Пример #10
0
 def loadTestsFromFile(self, filename, indexes=[]):
     if self.wantFile( filename ):
         log.debug("Loading from file %s" % filename)
         
         step_registry = StepImplRegistry(TagMatcher)
         try:
             feat = load_feature(filename, self.language)
             path = os.path.dirname(filename)
             self.impl_loader.load_steps_impl(step_registry, path, feat.use_step_defs)
         except ParseException, e:
             ec, ev, tb = sys.exc_info()
             yield Failure(ParseException, ParseException(e.pstr, e.loc, e.msg + " in %s" % filename), tb)
             return
         
         cnt = 0
         ctx = FeatureSuite()
         for i, sc in enumerate(feat.iter_scenarios()):
             if (not indexes or (i + 1) in indexes):
                 if self.tagmatcher.check_match(sc.tags + feat.tags):
                     yield FreshenTestCase(StepsRunner(step_registry), step_registry, feat, sc, ctx)
                     cnt += 1
         
         if not cnt:
             yield False
Пример #11
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