diff options
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index d5a6a4f..fa96f9a 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -23,7 +23,6 @@ import os import sys import time import array -import threading import random import unittest import weakref @@ -35,6 +34,10 @@ from test import support import codecs import io # C implementation of io import _pyio as pyio # Python implementation of io +try: + import threading +except ImportError: + threading = None def _default_chunk_size(): @@ -742,6 +745,7 @@ class BufferedReaderTest(unittest.TestCase, CommonBufferedTests): self.assertEquals(b"abcdefg", bufio.read()) + @unittest.skipUnless(threading, 'Threading required for this test.') def test_threads(self): try: # Write out many bytes with exactly the same number of 0's, @@ -988,6 +992,7 @@ class BufferedWriterTest(unittest.TestCase, CommonBufferedTests): with self.open(support.TESTFN, "rb", buffering=0) as f: self.assertEqual(f.read(), b"abc") + @unittest.skipUnless(threading, 'Threading required for this test.') def test_threads(self): try: # Write out many bytes from many threads and test they were @@ -2080,7 +2085,7 @@ class TextIOWrapperTest(unittest.TestCase): with self.open(support.TESTFN, "w", errors="replace") as f: self.assertEqual(f.errors, "replace") - + @unittest.skipUnless(threading, 'Threading required for this test.') def test_threads_write(self): # Issue6750: concurrent writes could duplicate data event = threading.Event() |