Example #1
0
    def __call__(self, test_obj):
        for headers, remaining in zip(map(set, self.request_headers),
                                      test_obj.request_remaining()):
            diff = headers.symmetric_difference(remaining)

            if diff:
                print_red(str(diff))
                raise TestFailed('Not all files were crawled correctly.')
Example #2
0
    def __exit__(self, exc_type, exc_val, exc_tb):
        """
        If the with statement got executed with no exception raised, then
        exc_type, exc_val, exc_tb are all None.
        """
        if exc_val:
            self.tests_passed = False
            if exc_type is TestFailed:
                print_red("Error: %s." % exc_val.error)
            else:
                print_red("Unhandled exception caught.")
                print(exc_val)
                traceback.print_tb(exc_tb)
        self.__test_cleanup()

        return True
Example #3
0
    def __exit__(self, exc_type, exc_val, exc_tb):
        """
        If the with statement got executed with no exception raised, then
        exc_type, exc_val, exc_tb are all None.
        """
        if exc_val:
            self.tests_passed = False
            if exc_type is TestFailed:
                print_red('Error: %s.' % exc_val.error)
            else:
                print_red('Unhandled exception caught.')
                print(exc_val)
                traceback.print_tb(exc_tb)
        self.__test_cleanup()

        return self.tests_passed