예제 #1
0
파일: rerun.py 프로젝트: xbx/behave
    def report_scenario_failures(self):
        assert self.failed_scenarios
        # -- SECTION: Banner
        message = u"# -- RERUN: %d failing scenarios during last test run.\n"
        self.stream.write(message % len(self.failed_scenarios))
        if self.show_timestamp:
            now = datetime.now().replace(microsecond=0)
            self.stream.write("# NOW: %s\n"% now.isoformat(" "))

        # -- SECTION: Textual summary in comments.
        if self.show_failed_scenarios_descriptions:
            current_feature = None
            for index, scenario in enumerate(self.failed_scenarios):
                if current_feature != scenario.filename:
                    if current_feature is not None:
                        self.stream.write(u"#\n")
                    current_feature = scenario.filename
                    short_filename = relpath(scenario.filename, os.getcwd())
                    self.stream.write(u"# %s\n" % short_filename)
                self.stream.write(u"#  %4d:  %s\n" % \
                                  (scenario.line, scenario.name))
            self.stream.write("\n")

        # -- SECTION: Scenario file locations, ala: "alice.feature:10"
        for scenario in self.failed_scenarios:
            self.stream.write(u"%s\n" % scenario.location)
        self.stream.write("\n")
예제 #2
0
파일: model.py 프로젝트: tucarga/behave
    def relpath(self, start=os.curdir):
        """
        Compute relative path for start to filename.

        :param start: Base path or start directory (default=current dir).
        :return: Relative path from start to filename
        """
        return relpath(self.filename, start)
예제 #3
0
파일: model.py 프로젝트: tucarga/behave
 def __init__(self, filename, line, keyword, name):
     filename = filename or '<string>'
     filename = relpath(filename, os.getcwd())   # -- NEEDS: abspath?
     self.location = FileLocation(filename, line)
     assert isinstance(keyword, unicode)
     assert isinstance(name, unicode)
     self.keyword = keyword
     self.name = name
예제 #4
0
파일: model.py 프로젝트: wirewit/behave
 def __init__(self, filename, line, keyword, name):
     filename = filename or '<string>'
     filename = relpath(filename, os.getcwd())  # -- NEEDS: abspath?
     self.location = FileLocation(filename, line)
     assert isinstance(keyword, unicode)
     assert isinstance(name, unicode)
     self.keyword = keyword
     self.name = name
예제 #5
0
파일: model.py 프로젝트: wirewit/behave
    def relpath(self, start=os.curdir):
        """
        Compute relative path for start to filename.

        :param start: Base path or start directory (default=current dir).
        :return: Relative path from start to filename
        """
        return relpath(self.filename, start)
예제 #6
0
파일: model.py 프로젝트: tucarga/behave
    def make_location(step_function):
        '''
        Extracts the location information from the step function and builds
        the location string (schema: "{source_filename}:{line_number}").

        :param step_function: Function whose location should be determined.
        :return: Step function location as string.
        '''
        filename = relpath(step_function.func_code.co_filename, os.getcwd())
        line_number = step_function.func_code.co_firstlineno
        return FileLocation(filename, line_number)
예제 #7
0
파일: model.py 프로젝트: wirewit/behave
    def make_location(step_function):
        '''
        Extracts the location information from the step function and builds
        the location string (schema: "{source_filename}:{line_number}").

        :param step_function: Function whose location should be determined.
        :return: Step function location as string.
        '''
        filename = relpath(step_function.func_code.co_filename, os.getcwd())
        line_number = step_function.func_code.co_firstlineno
        return FileLocation(filename, line_number)
예제 #8
0
 def feature(self, feature):
     self.current_feature = feature
     short_filename = relpath(feature.filename, os.getcwd())
     self.stream.write("%s  " % short_filename)
     self.stream.flush()
예제 #9
0
 def feature(self, feature):
     self.current_feature = feature
     short_filename = relpath(feature.filename, os.getcwd())
     self.stream.write(u"%s    # %s" % (feature.name, short_filename))
예제 #10
0
 def location(self):
     p = relpath(self.filename, os.getcwd())
     return '%s:%d' % (p, self.line)
예제 #11
0
 def filename(self):
     if not self._filename:
         if self.step_definitions:
             filename = inspect.getfile(self.step_definitions[0].func)
             self._filename = relpath(filename)
     return self._filename
예제 #12
0
 def filename(self):
     if not self._filename:
         if self.step_definitions:
             filename = inspect.getfile(self.step_definitions[0].func)
             self._filename = relpath(filename)
     return self._filename
예제 #13
0
파일: progress.py 프로젝트: jgr21/behave
 def feature(self, feature):
     self.current_feature = feature
     short_filename = relpath(feature.filename, os.getcwd())
     self.stream.write("%s  " % short_filename)