This file is indexed.

/usr/lib/python2.7/dist-packages/nose2/tests/unit/test_mp_plugin.py is in python-nose2 0.5.0-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
from nose2 import session
from nose2.tests._common import TestCase, Conn
from nose2.plugins import mp
import sys


class TestMPPlugin(TestCase):

    def setUp(self):
        self.session = session.Session()
        self.plugin = mp.MultiProcess(session=self.session)

    def test_gentests(self):
        conn = Conn([1, 2, 3])
        res = []
        for x in mp.gentests(conn):
            res.append(x)
        self.assertEqual(res, [1, 2, 3])

    def test_recording_plugin_interface(self):
        rpi = mp.RecordingPluginInterface()
        # this one should record
        rpi.setTestOutcome(None)
        # none of these should record
        rpi.getTestCaseNames(None)
        rpi.startSubprocess(None)
        rpi.stopSubprocess(None)
        rpi.registerInSubprocess(None)
        rpi.loadTestsFromModule(None)
        rpi.loadTestsFromTestCase(None)
        self.assertEqual(rpi.flush(), [('setTestOutcome', None)])

    def test_address(self):
        platform = sys.platform
        try:
            sys.platform = "linux"
            host = "1.2.3.4"
            port = 245
            self.plugin.setAddress(host)
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             (host, 0))
            self.plugin.setAddress("%s:%i" % (host, port))
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             (host, port))
            self.plugin.setAddress(None)
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             (None, 0))
            sys.platform = "win32"
            self.plugin.setAddress(host)
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             (host, 0))
            self.plugin.setAddress("%s:%i" % (host, port))
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             (host, port))
            self.plugin.setAddress(None)
            self.assertEqual((self.plugin.bind_host, self.plugin.bind_port),
                             ("127.116.157.163", 0))
        finally:
            sys.platform = platform