Author: Anthony Sottile <[email protected]>
Branch: Anthony-Sottile/fix-leak-of-file-descriptor-with-_iofile-1559687440863
Changeset: r96744:d8bc809612bd
Date: 2019-06-05 04:35 +0000
http://bitbucket.org/pypy/pypy/changeset/d8bc809612bd/
Log: add regression test for `FileIO` directory fd leak
diff --git a/pypy/module/_io/test/test_fileio.py
b/pypy/module/_io/test/test_fileio.py
--- a/pypy/module/_io/test/test_fileio.py
+++ b/pypy/module/_io/test/test_fileio.py
@@ -57,8 +57,11 @@
def test_open_directory(self):
import _io
- import os
- raises(IOError, _io.FileIO, self.tmpdir, "rb")
+ import os, warnings
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter('always', ResourceWarning)
+ raises(IOError, _io.FileIO, self.tmpdir, "rb")
+ assert len(w) == 0
if os.name != 'nt':
fd = os.open(self.tmpdir, os.O_RDONLY)
raises(IOError, _io.FileIO, fd, "rb")
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit