This file is indexed.

/usr/share/pyshared/zope/testrunner/testrunner-layers-ntd.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
Layers that can't be torn down
==============================

A layer can have a tearDown method that raises NotImplementedError.
If this is the case and there are no remaining tests to run, the test
runner will just note that the tear down couldn't be done:

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

    >>> sys.argv = 'test -ssample2 --tests-pattern sampletests_ntd$'.split()
    >>> testrunner.run_internal(defaults)
    Running sample2.sampletests_ntd.Layer tests:
      Set up sample2.sampletests_ntd.Layer in 0.000 seconds.
      Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
    Tearing down left over layers:
      Tear down sample2.sampletests_ntd.Layer ... not supported
    False

If the tearDown method raises NotImplementedError and there are remaining
layers to run, the test runner will restart itself as a new process,
resuming tests where it left off:

    >>> sys.argv = [testrunner_script, '--tests-pattern', 'sampletests_ntd$']
    >>> testrunner.run_internal(defaults)
    Running sample1.sampletests_ntd.Layer tests:
      Set up sample1.sampletests_ntd.Layer in N.NNN seconds.
      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
    Running sample2.sampletests_ntd.Layer tests:
      Tear down sample1.sampletests_ntd.Layer ... not supported
      Running in a subprocess.
      Set up sample2.sampletests_ntd.Layer in N.NNN seconds.
      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
      Tear down sample2.sampletests_ntd.Layer ... not supported
    Running sample3.sampletests_ntd.Layer tests:
      Running in a subprocess.
      Set up sample3.sampletests_ntd.Layer in N.NNN seconds.
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_error1 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_error1
        raise TypeError("Can we see errors")
    TypeError: Can we see errors
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_error2 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_error2
        raise TypeError("I hope so")
    TypeError: I hope so
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Failure in test test_fail1 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_fail1
        self.assertEqual(1, 2)
    AssertionError: 1 != 2
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Failure in test test_fail2 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_fail2
        self.assertEqual(1, 3)
    AssertionError: 1 != 3
    <BLANKLINE>
      Ran 6 tests with 2 failures and 2 errors in N.NNN seconds.
      Tear down sample3.sampletests_ntd.Layer ... not supported
    Total: 8 tests, 2 failures, 2 errors in N.NNN seconds.
    True

in the example above, some of the tests run as a subprocess had errors
and failures. They were displayed as usual and the failure and error
statistice were updated as usual.

Note that debugging doesn't work when running tests in a subprocess:

    >>> sys.argv = [testrunner_script, '--tests-pattern', 'sampletests_ntd$',
    ...             '-D', ]
    >>> testrunner.run_internal(defaults)
    Running sample1.sampletests_ntd.Layer tests:
      Set up sample1.sampletests_ntd.Layer in N.NNN seconds.
      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
    Running sample2.sampletests_ntd.Layer tests:
      Tear down sample1.sampletests_ntd.Layer ... not supported
      Running in a subprocess.
      Set up sample2.sampletests_ntd.Layer in N.NNN seconds.
      Ran 1 tests with 0 failures and 0 errors in N.NNN seconds.
      Tear down sample2.sampletests_ntd.Layer ... not supported
    Running sample3.sampletests_ntd.Layer tests:
      Running in a subprocess.
      Set up sample3.sampletests_ntd.Layer in N.NNN seconds.
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_error1 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_error1
        raise TypeError("Can we see errors")
    TypeError: Can we see errors
    <BLANKLINE>
    <BLANKLINE>
    **********************************************************************
    Can't post-mortem debug when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_error2 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_error2
        raise TypeError("I hope so")
    TypeError: I hope so
    <BLANKLINE>
    <BLANKLINE>
    **********************************************************************
    Can't post-mortem debug when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_fail1 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_fail1
        self.assertEqual(1, 2)
    AssertionError: 1 != 2
    <BLANKLINE>
    <BLANKLINE>
    **********************************************************************
    Can't post-mortem debug when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    <BLANKLINE>
    <BLANKLINE>
    Error in test test_fail2 (sample3.sampletests_ntd.TestSomething)
    Traceback (most recent call last):
     testrunner-ex/sample3/sampletests_ntd.py", Line NNN, in test_fail2
        self.assertEqual(1, 3)
    AssertionError: 1 != 3
    <BLANKLINE>
    <BLANKLINE>
    **********************************************************************
    Can't post-mortem debug when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
      Ran 6 tests with 0 failures and 4 errors in N.NNN seconds.
      Tear down sample3.sampletests_ntd.Layer ... not supported
    Total: 8 tests, 0 failures, 4 errors in N.NNN seconds.
    True

Similarly, pdb.set_trace doesn't work when running tests in a layer
that is run as a subprocess:

    >>> sys.argv = [testrunner_script, '--tests-pattern', 'sampletests_ntds']
    >>> testrunner.run_internal(defaults)
    Running sample1.sampletests_ntds.Layer tests:
      Set up sample1.sampletests_ntds.Layer in 0.000 seconds.
      Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
    Running sample2.sampletests_ntds.Layer tests:
      Tear down sample1.sampletests_ntds.Layer ... not supported
      Running in a subprocess.
      Set up sample2.sampletests_ntds.Layer in 0.000 seconds.
    --Return--
    > testrunner-ex/sample2/sampletests_ntds.py(37)test_something()->None
    -> import pdb; pdb.set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > testrunner-ex/sample2/sampletests_ntds.py(40)test_something2()->None
    -> import pdb; pdb.set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > testrunner-ex/sample2/sampletests_ntds.py(43)test_something3()->None
    -> import pdb; pdb.set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > testrunner-ex/sample2/sampletests_ntds.py(46)test_something4()->None
    -> import pdb; pdb.set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > testrunner-ex/sample2/sampletests_ntds.py(52)f()->None
    -> import pdb; pdb.set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > doctest.py(351)set_trace()->None
    -> Pdb().set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
    --Return--
    > doctest.py(351)set_trace()->None
    -> Pdb().set_trace()
    (Pdb) c
    <BLANKLINE>
    **********************************************************************
    Can't use pdb.set_trace when running a layer as a subprocess!
    **********************************************************************
    <BLANKLINE>
      Ran 7 tests with 0 failures and 0 errors in 0.008 seconds.
      Tear down sample2.sampletests_ntds.Layer ... not supported
    Total: 8 tests, 0 failures, 0 errors in N.NNN seconds.
    False

If you want to use pdb from a test in a layer that is run as a
subprocess, then rerun the test runner selecting *just* that layer so
that it's not run as a subprocess.


If a test is run in a subprocess and it generates output on stderr (as
stderrtest does), the output is ignored (but it doesn't cause a SubprocessError
like it once did).

    >>> from cStringIO import StringIO
    >>> real_stderr = sys.stderr
    >>> sys.stderr = StringIO()

    >>> sys.argv = [testrunner_script, '-s', 'sample2', '--tests-pattern',
    ...     '(sampletests_ntd$|stderrtest)']
    >>> testrunner.run_internal(defaults)
    Running sample2.sampletests_ntd.Layer tests:
      Set up sample2.sampletests_ntd.Layer in 0.000 seconds.
      Ran 1 tests with 0 failures and 0 errors in 0.000 seconds.
    Running sample2.stderrtest.Layer tests:
      Tear down sample2.sampletests_ntd.Layer ... not supported
      Running in a subprocess.
      Set up sample2.stderrtest.Layer in 0.000 seconds.
      Ran 1 tests with 0 failures and 0 errors in 0.002 seconds.
      Tear down sample2.stderrtest.Layer in 0.000 seconds.
    Total: 2 tests, 0 failures, 0 errors in 0.197 seconds.
    False

    >>> print(sys.stderr.getvalue())
    A message on stderr.  Please ignore (expected in test output).

    >>> sys.stderr = real_stderr