This file is indexed.

/usr/share/pyshared/gluon/tests/test_languages.py is in python-gluon 1.99.7-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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
    Unit tests for gluon.languages
"""

import sys
import os
if os.path.isdir('gluon'):
    sys.path.append(os.path.realpath('gluon'))
else:
    sys.path.append(os.path.realpath('../'))

import unittest
import languages
import tempfile
import threading
import logging

try:
    import multiprocessing

    def read_write(args):
        (filename, iterations) = args
        for i in range(0, iterations):
            content = languages.read_dict(filename)
            if not len(content):
                return False
            languages.write_dict(filename, content)
        return True

    class TestLanguagesParallel(unittest.TestCase):
    
        def setUp(self):
            self.filename = tempfile.mktemp()
            contents = dict()
            for i in range(1000):
                contents["key%d" % i] = "value%d" % i
            languages.write_dict(self.filename, contents)
            languages.read_dict(self.filename)

        def tearDown(self):
            try:
                os.remove(self.filename)
            except:
                pass
    
        def test_reads_and_writes(self):
            readwriters = 10
            pool = multiprocessing.Pool(processes = readwriters)
            results = pool.map(read_write, [[self.filename, 10]] * readwriters)
            for result in results:
                self.assertTrue(result)

except ImportError:
    logging.warning("Skipped test case, no multiprocessing module.")
        
if __name__ == '__main__':
    unittest.main()