This file is indexed.

/usr/lib/python2.7/dist-packages/pyvows/runner/abc.py is in python-pyvows 2.0.6-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# -*- coding: utf-8 -*-
'''Abstract base class for all PyVows Runner implementations.'''
 
 
# pyvows testing engine
# https://github.com/heynemann/pyvows
 
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 Bernardo Heynemann heynemann@gmail.com
 
import re, sys, time
 
from pyvows.runner.utils import get_code_for, get_file_info_for, get_topics_for
from pyvows.utils import elapsed

#-------------------------------------------------------------------------------------------------

class VowsRunnerABC(object):
     
    def __init__(self, suites, context_class, on_vow_success, on_vow_error, exclusion_patterns):
        self.suites = suites  # a suite is a file with pyvows tests
        self.context_class = context_class
        self.on_vow_success = on_vow_success
        self.on_vow_error = on_vow_error
        self.exclusion_patterns = exclusion_patterns
        if self.exclusion_patterns:
            self.exclusion_patterns = set([re.compile(x) for x in self.exclusion_patterns])
 
    def is_excluded(self, name):
        '''Return whether `name` is in `self.exclusion_patterns`.'''
        for pattern in self.exclusion_patterns:
            if pattern.search(name):
                return True
        return False
         
    def run(self):
        pass
     
    def run_context(self):
        pass
     
    def run_vow(self, tests_collection, topic, ctx_obj, vow, vow_name, enumerated):
        #   FIXME: Add Docstring
 
        start_time = time.time()
        filename, lineno = get_file_info_for(vow._original)
 
        vow_result = {
            'context_instance': ctx_obj,
            'name': vow_name,
            'enumerated': enumerated,
            'result': None,
            'topic': topic,
            'error': None,
            'succeeded': False,
            'file': filename,
            'lineno': lineno,
            'elapsed': 0
        }
 
        try:
            result = vow(ctx_obj, topic)
            vow_result['result'] = result
            vow_result['succeeded'] = True
            if self.on_vow_success:
                self.on_vow_success(vow_result)
 
        except:
            #   FIXME:
            #
            #   Either...
            #       *   Describe why we're catching every exception, or
            #       *   Fix to catch specific kinds of exceptions
            err_type, err_value, err_traceback = sys.exc_info()
            vow_result['error'] = {
                'type': err_type,
                'value': err_value,
                'traceback': err_traceback
            }
            if self.on_vow_error:
                self.on_vow_error(vow_result)
 
        vow_result['elapsed'] = elapsed(start_time)
        tests_collection.append(vow_result)
 
        return vow_result


class VowsTopicError(Exception):
    """Wraps an error in the setup or topic functions."""
    def __init__(self, source, exc_info):
        self.source = source
        self.exc_info = exc_info