This file is indexed.

/usr/lib/python2.7/dist-packages/testfixtures/components.py is in python-testfixtures 4.14.3-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
# Copyright (c) 2010-2011 Simplistix Ltd
# See license.txt for license details.

import atexit
import warnings

from zope.component import getSiteManager
from zope.component.registry import Components


class TestComponents:
    """
    A helper for providing a sterile registry when testing
    with :mod:`zope.component`.

    Instantiation will install an empty registry that will be returned
    by :func:`zope.component.getSiteManager`.
    """

    instances = set()
    atexit_setup = False

    def __init__(self):
        self.registry = Components('Testing')
        self.old = getSiteManager.sethook(lambda: self.registry)
        self.instances.add(self)
        if not self.__class__.atexit_setup:
            atexit.register(self.atexit)
            self.__class__.atexit_setup = True

    def uninstall(self):
        """
        Remove the sterile registry and replace it with the one that
        was in place before this :class:`TestComponents` was
        instantiated.
        """
        getSiteManager.sethook(self.old)
        self.instances.remove(self)

    @classmethod
    def atexit(cls):
        if cls.instances:
            warnings.warn(
                'TestComponents instances not uninstalled by shutdown!'
                )