Merge 3.2

This commit is contained in:
Richard Oudkerk 2012-08-14 12:51:14 +01:00
commit 3165a75e45
4 changed files with 40 additions and 2 deletions

View file

@ -20,6 +20,7 @@ import random
import logging
import struct
import test.support
import test.script_helper
# Skip tests if _multiprocessing wasn't built.
@ -3346,9 +3347,29 @@ class TestTimeouts(unittest.TestCase):
finally:
socket.setdefaulttimeout(old_timeout)
#
# Test what happens with no "if __name__ == '__main__'"
#
class TestNoForkBomb(unittest.TestCase):
def test_noforkbomb(self):
name = os.path.join(os.path.dirname(__file__), 'mp_fork_bomb.py')
if WIN32:
rc, out, err = test.script_helper.assert_python_failure(name)
self.assertEqual('', out.decode('ascii'))
self.assertIn('RuntimeError', err.decode('ascii'))
else:
rc, out, err = test.script_helper.assert_python_ok(name)
self.assertEqual('123', out.decode('ascii').rstrip())
self.assertEqual('', err.decode('ascii'))
#
#
#
testcases_other = [OtherTest, TestInvalidHandle, TestInitializers,
TestStdinBadfiledescriptor, TestWait, TestInvalidFamily,
TestFlags, TestTimeouts]
TestFlags, TestTimeouts, TestNoForkBomb]
#
#