Issue 24157: test_urandom_fd_reopened failure if OS X crash reporter default set to Developer (original) (raw)

Created on 2015-05-10 14:10 by skip.montanaro, last changed 2022-04-11 14:58 by admin.

Messages (5)
msg242856 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-10 14:10
Got this reproducibly on the cpython branch on my Mac (Yosemite 10.10.3). It succeeds on my 3.4 branch, both updated a few minutes ago. Didn't see it already reported: % ./python.exe Lib/test/test_os.py ....s..............................sss.............s....s...........s.......................sssss.sss.s.........ss....................................s........F.......ssssssssssssssssssssss ====================================================================== FAIL: test_urandom_fd_reopened (__main__.URandomFDTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "Lib/test/test_os.py", line 1273, in test_urandom_fd_reopened self.assertEqual(len(out), 8) AssertionError: 66 != 8 ---------------------------------------------------------------------- Ran 189 tests in 1.352s FAILED (failures=1, skipped=41)
msg242918 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-05-11 21:31
Skip, looking at the test, it seems likely that there is unexpected writing to stdout in the subprocess. Can you add a print(out) in the test (around test_os.py:1273) to see what is actually being written on your machine?
msg243137 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-14 00:55
Sorry for the delay. With LANG=C I get this extra bit of output: 'this test triggers the Crash Reporter, that is intentional\x80TbG=\x0f\x19t' With LANG=en_US.UTF-8 (the encoding of my Terminal instance), I get this: 'this test triggers the Crash Reporter, that is intentional\xf6\xcd\x7f\xf1O\x91\t\xac'
msg243225 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-05-14 22:21
OK, that explains the failure. You must have set the OS X crash reporter default to "Developer" mode on that machine at some point. In that case, code that is now in the SuppressCrashReport context manager in Lib/test/support/__init__.py checks for that setting by "shelling out" on OS X to /usr/bin/defaults for each use of the context manager in tests and, if set to "Developer", outputs that message to stdout. So that will interfere with a test like this where the contents of stdout is used as part of the test. But the code seems problematic in a couple of other respects. You can still get some crash popups even if the preference is not set to Developer. Also if the preference has never been set, you get a spurious error message to stderr for each test case that uses the context manager: 2015-05-14 14:34:44.185 defaults[90018:2205666] The domain/default pair of (/Users/nad/Library/Preferences/com.apple.CrashReporter, DialogType) does not exist My initial reaction without full testing of the effects of the Crash Reporter settings would be to: (1) not print a message to stdout since none of the other non-OS X cases do; (2) cache the results of the initial /usr/bin/defaults call. As a workaround, you could comment out the print. https://developer.apple.com/library/mac/technotes/tn2004/tn2123.html
msg243238 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-05-15 01:24
> OK, that explains the failure. You must have set the OS X crash reporter default to "Developer" mode on that machine at some point. Thanks. I certainly don't remember doing anything like that. (I'm not a Mac user at such a sophisticated level.) At any rate, I set it to "server" and verified that the crash reporter stopped being displayed. Skip
History
Date User Action Args
2022-04-11 14:58:16 admin set github: 68345
2015-07-08 23:17:49 vstinner set nosy: + vstinner
2015-05-15 01:24:34 skip.montanaro set messages: +
2015-05-14 22:21:01 ned.deily set nosy: + ronaldoussorentitle: test_urandom_fd_reopened failure on Mac OS X -> test_urandom_fd_reopened failure if OS X crash reporter default set to Developermessages: + stage: needs patch
2015-05-14 00:55:59 skip.montanaro set messages: +
2015-05-11 21:31:19 ned.deily set nosy: + ned.deilymessages: +
2015-05-10 14:10:25 skip.montanaro create