This file is indexed.

/usr/lib/python2.7/dist-packages/zope/testing/cleanup.py is in python-zope.testing 4.1.2-0ubuntu7.

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
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Provide a standard cleanup registry

Unit tests that change global data should include the CleanUp base
class, which provides simpler setUp and tearDown methods that call
global-data cleanup routines::

  class Test(CleanUp, unittest.TestCase):

      ....

If custom setUp or tearDown are needed, then the base routines should
be called, as in::

  def tearDown(self):
      super(Test, self).tearDown()
      ....

Cleanup routines for global data should be registered by passing them to
addCleanup::


  addCleanUp(pigRegistry._clear)

"""
_cleanups = []

def addCleanUp(func, args=(), kw={}):
    """Register a cleanup routines

    Pass a function to be called to cleanup global data.
    Optional argument tuple and keyword arguments may be passed.
    """
    _cleanups.append((func, args, kw))

class CleanUp(object):
    """Mix-in class providing clean-up setUp and tearDown routines."""

    def cleanUp(self):
        """Clean up global data."""
        cleanUp()

    setUp = tearDown = cleanUp


def cleanUp():
    """Clean up global data."""
    for func, args, kw in _cleanups:
        func(*args, **kw)

setUp = tearDown = cleanUp