bpo-28286: Deprecate opening GzipFile for writing implicitly. (GH-16417)
Always specify the mode argument for writing.
diff --git a/Lib/test/test_gzip.py b/Lib/test/test_gzip.py
index 48a36a3..57d851c 100644
--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -469,7 +469,9 @@
if "x" in mode:
support.unlink(self.filename)
with open(self.filename, mode) as f:
- with gzip.GzipFile(fileobj=f) as g:
+ with self.assertWarns(FutureWarning):
+ g = gzip.GzipFile(fileobj=f)
+ with g:
self.assertEqual(g.mode, gzip.WRITE)
def test_bytes_filename(self):