diff -r 811ccdee6f87 Lib/test/test_io.py --- a/Lib/test/test_io.py Wed May 04 09:44:44 2016 +0300 +++ b/Lib/test/test_io.py Wed May 04 21:07:28 2016 +0200 @@ -264,6 +264,29 @@ BlockingIOError = pyio.BlockingIOError +def _setrlimit_largefile_failure(size): + # True when failing to set the maximum size of a file which a process may + # create, to the size of a large file. + try: + import resource + except ImportError: + pass + if hasattr(resource, 'RLIMIT_FSIZE'): + code = """if 1: + import resource + + soft, hard = resource.getrlimit(resource.RLIMIT_FSIZE) + resource.setrlimit(resource.RLIMIT_FSIZE, (%d, hard)) + print(resource.getrlimit(resource.RLIMIT_FSIZE)[0]) + """ + (rc, out, err), _ = run_python_until_end("-c", code % size) + try: + rlimit = int(out.strip()) + except ValueError: + return True + else: + return rc != 0 or rlimit != size + class IOTest(unittest.TestCase): def setUp(self): @@ -525,6 +548,8 @@ f = self.BytesIO(data) self.read_ops(f, True) + @unittest.skipIf(_setrlimit_largefile_failure(LARGE + 3), + 'large file is not supported') def test_large_file_ops(self): # On Windows and Mac OSX this test comsumes large resources; It takes # a long time to build the >2GB file and takes >2GB of disk space