/usr/lib/python2.7/dist-packages/zope/testrunner/tests/testrunner-layers-cantfind.txt is in python-zope.testrunner 4.4.9-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 | Failure to find layers should not pass silently
===============================================
This is a regression test for the following bug: you try to run several
test layers using subprocesses (e.g. because you used bin/test -j99),
and the child process somehow is unable to find the layer it was supposed
to be running. This is a serious problem that should not pass silently.
Instead of setting up the conditions for this problem to actually occur
in practice we'll simulate the subprocess invocation using --resume-layer.
>>> import os.path, sys
>>> directory_with_tests = os.path.join(this_directory, 'testrunner-ex')
>>> defaults = [
... '--path', directory_with_tests,
... '--tests-pattern', '^sampletestsf?$',
... ]
The test runner does some funky stuff in this case, specifically, it
closes sys.stdout, which makes doctest unhappy, so we stub the close
method out.
>>> sys.stdout.close = lambda: None
>>> from six import StringIO
>>> orig_stderr = sys.stderr
>>> sys.stderr = fake_stderr = StringIO()
>>> sys.argv = 'test --resume-layer NoSuchLayer 0'.split()
>>> from zope import testrunner
>>> testrunner.run_internal(defaults)
<BLANKLINE>
**********************************************************************
Cannot find layer NoSuchLayer
**********************************************************************
<BLANKLINE>
Total: 0 tests, 0 failures, 1 errors and 0 skipped in 0.000 seconds.
True
It also prints to stderr to communicate with the parent process
>>> print(fake_stderr.getvalue(), end='')
0 0 1
subprocess failed for NoSuchLayer
Cleanup
>>> del sys.stdout.close
>>> sys.stderr = orig_stderr
|