This file is indexed.

/usr/share/pyshared/wxglade/test.py is in python-wxglade 0.6.8-1.

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
#!/usr/bin/env  python
"""
Create a test suites and run all tests

@see: L{wxglade.tests}

@copyright: 2012 Carsten Grohmann
@license: MIT (see license.txt) - THIS PROGRAM COMES WITH NO WARRANTY
"""

# import general python modules
import gettext
import imp
import os
import unittest
from optparse import OptionParser

t = gettext.translation(domain="wxglade", localedir="locale", fallback=True)
t.install("wxglade")


def run_tests(gui_tests=False):
    """\
    Create test suites and run all tests

    @param gui_tests: Test GUI components or test internal functionality
    @type gui_tests:  Boolean
    """
    suites = []

    # get a list of all test modules
    modules = os.listdir('./tests')
    if '__init__.py' in modules:
        modules.remove('__init__.py')

    # try to import all files as modules
    for module_name in modules:
        if (not module_name.endswith('.py')) or \
           (gui_tests and not module_name.endswith('_gui.py')) or \
           (not gui_tests and module_name.endswith('_gui.py')):
            continue
        module_name = os.path.splitext(module_name)[0]
        fp, path, info = imp.find_module(module_name, ['./tests'])
        try:
            module = imp.load_module(module_name, fp, path, info)

        finally:
            # Make sure fp is closed properly
            if fp:
                fp.close()

        # search all testcases in the loaded module
        suites.append(unittest.findTestCases(module))

    # summarise all suites and run tests
    all_tests = unittest.TestSuite(suites)
    unittest.TextTestRunner(verbosity=2).run(all_tests)


if __name__ == '__main__':
    # evaluate command line options first
    parser = OptionParser(
        usage="%prog [options]  Test wxGlade components",
        )
    parser.add_option(
        '-g',
        '--gui',
        dest='gui_tests',
        default=False,
        action='store_true',
        help=_('Test GUI components instead of non-GUI components'),
        )

    (options, args) = parser.parse_args()

    run_tests(options.gui_tests)