This file is indexed.

/usr/share/pyshared/grokcore/component/tests/test_grok.py is in python-grokcore.component 2.5-0ubuntu1.

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
import re
import unittest
import traceback
import doctest
from pkg_resources import resource_listdir
from zope.testing import cleanup, renormalizing
import zope.component.eventtesting

def setUpZope(test):
    zope.component.eventtesting.setUp(test)

def cleanUpZope(test):
    cleanup.cleanUp()

checker = renormalizing.RENormalizing([
    # str(Exception) has changed from Python 2.4 to 2.5 (due to
    # Exception now being a new-style class).  This changes the way
    # exceptions appear in traceback printouts.
    (re.compile(r"ConfigurationExecutionError: <class '([\w.]+)'>:"),
                r'ConfigurationExecutionError: \1:'),
    ])

def suiteFromPackage(name):
    files = resource_listdir(__name__, name)
    suite = unittest.TestSuite()
    for filename in files:
        if not filename.endswith('.py'):
            continue
        if filename.endswith('_fixture.py'):
            continue
        if filename == '__init__.py':
            continue

        dottedname = 'grokcore.component.tests.%s.%s' % (name, filename[:-3])
        try:
            test = doctest.DocTestSuite(dottedname,
                                        setUp=setUpZope,
                                        tearDown=cleanUpZope,
                                        checker=checker,
                                        optionflags=doctest.ELLIPSIS+
                                        doctest.NORMALIZE_WHITESPACE)
        except ImportError:  # or should this accept anything?
            traceback.print_exc()
            raise
        suite.addTest(test)
    return suite

def test_suite():
    suite = unittest.TestSuite()
    for name in ['adapter', 'directive', 'grokker', 'utility', 'view',
                 'event', 'inherit', 'order', 'subscriptions']:
        suite.addTest(suiteFromPackage(name))

    api = doctest.DocFileSuite('api.txt')
    suite.addTest(api)

    # this test cannot follow the normal testing pattern, as the
    # bug it tests for is only exposed in the context of a doctest
    grok_component = doctest.DocFileSuite('grok_component.txt',
                                          setUp=setUpZope,
                                          tearDown=cleanUpZope)
    suite.addTest(grok_component)
    return suite

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')