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)
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?
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'
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
> 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
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