This file is indexed.

/usr/share/pyshared/zope/testrunner/testrunner-subunit-leaks.txt is in python-zope.testrunner 4.0.3-3.

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
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
Debugging Memory Leaks with subunit output
==========================================

The --report-refcounts (-r) option can be used with the --repeat (-N)
option to detect and diagnose memory leaks.  To use this option, you
must configure Python with the --with-pydebug option. (On Unix, pass
this option to configure and then build Python.)

For more detailed documentation, see testrunner-leaks.txt.

    >>> import os.path, sys
    >>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
    >>> defaults = [
    ...     '--path', directory_with_tests,
    ...     '--tests-pattern', '^sampletestsf?$',
    ...     ]

    >>> from zope import testrunner

Each layer is repeated the requested number of times.  For each
iteration after the first, the system refcount and change in system
refcount is shown. The system refcount is the total of all refcount in
the system.  When a refcount on any object is changed, the system
refcount is changed by the same amount.  Tests that don't leak show
zero changes in system refcount.

Let's look at an example test that leaks:

    >>> sys.argv = 'test --subunit --tests-pattern leak -N2 -r'.split()
    >>> _ = testrunner.run_internal(defaults)
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    test: zope.testrunner.layer.UnitTests:setUp
    tags: zope:layer
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    successful: zope.testrunner.layer.UnitTests:setUp
    tags: zope:layer:zope.testrunner.layer.UnitTests
    test: leak.TestSomething.testleak
    successful: leak.TestSomething.testleak
    test: leak.TestSomething.testleak
    successful: leak.TestSomething.testleak
    test: zope:refcounts
    tags: zope:refcounts
    successful: zope:refcounts [ multipart
    Content-Type: text/plain;charset=utf8
    ...
    ...\r
    <BLANKLINE>
    ...\r
    <BLANKLINE>
    Content-Type: text/plain;charset=utf8
    ...
    ...\r
    <BLANKLINE>
    ...\r
    <BLANKLINE>
    ]
    tags: -zope:layer:zope.testrunner.layer.UnitTests
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    test: zope.testrunner.layer.UnitTests:tearDown
    tags: zope:layer
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    successful: zope.testrunner.layer.UnitTests:tearDown

Here we see that the system refcount is increasing.  If we specify a
verbosity greater than one, we can get details broken out by object
type (or class):

    >>> sys.argv = 'test --subunit --tests-pattern leak -N2 -v -r'.split()
    >>> _ = testrunner.run_internal(defaults)
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    test: zope.testrunner.layer.UnitTests:setUp
    tags: zope:layer
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    successful: zope.testrunner.layer.UnitTests:setUp
    tags: zope:layer:zope.testrunner.layer.UnitTests
    test: leak.TestSomething.testleak
    successful: leak.TestSomething.testleak
    test: leak.TestSomething.testleak
    successful: leak.TestSomething.testleak
    test: zope:refcounts
    tags: zope:refcounts
    successful: zope:refcounts [ multipart
    Content-Type: text/plain;charset=utf8
    ...
    ...\r
    <BLANKLINE>
    ...\r
    <BLANKLINE>
    Content-Type: text/plain;charset=utf8
    ...
    ...\r
    <BLANKLINE>
    ...\r
    <BLANKLINE>
    Content-Type: text/plain;charset=utf8
    ...
    ...\r
    <BLANKLINE>
    ...
    <BLANKLINE>
    ]
    tags: -zope:layer:zope.testrunner.layer.UnitTests
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    test: zope.testrunner.layer.UnitTests:tearDown
    tags: zope:layer
    time: YYYY-MM-DD HH:MM:SS.mmmmmmZ
    successful: zope.testrunner.layer.UnitTests:tearDown