summaryrefslogtreecommitdiff
path: root/Lib/test/test_bz2.py
diff options
context:
space:
mode:
authorNadeem Vawda <nadeem.vawda@gmail.com>2012-01-18 01:57:14 +0200
committerNadeem Vawda <nadeem.vawda@gmail.com>2012-01-18 01:57:14 +0200
commit72750a85f970dc7d79c44c63fd02157634984762 (patch)
tree2ab726420e409a5cf764d96f1f1a6efb688ba4a5 /Lib/test/test_bz2.py
parent7422b22e5e2b5462908b4f5f45574ef2de7961c6 (diff)
downloadcpython-git-72750a85f970dc7d79c44c63fd02157634984762.tar.gz
Issue #13809: Make bz2 module work with threads disabled.
Original patch by Amaury Forgeot d'Arc.
Diffstat (limited to 'Lib/test/test_bz2.py')
-rw-r--r--Lib/test/test_bz2.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index bd40f83fcf..0f8d14910f 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -463,6 +463,13 @@ class BZ2FileTest(BaseTest):
for t in threads:
t.join()
+ def testWithoutThreading(self):
+ bz2 = support.import_fresh_module("bz2", blocked=("threading",))
+ with bz2.BZ2File(self.filename, "wb") as f:
+ f.write(b"abc")
+ with bz2.BZ2File(self.filename, "rb") as f:
+ self.assertEqual(f.read(), b"abc")
+
def testMixedIterationAndReads(self):
self.createTempFile()
linelen = len(self.TEXT_LINES[0])