diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-01-19 21:00:09 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-01-19 21:00:09 (GMT) |
commit | 7522c748b1548c14dcc88a4857ab963d7fe66e84 (patch) | |
tree | a781c14fe27532678bbbaeafc79e0d7fe2bb01ba /Lib/test/support.py | |
parent | 9053d7548592f4a583d99595d9bbf0050e920da4 (diff) | |
download | cpython-7522c748b1548c14dcc88a4857ab963d7fe66e84.zip cpython-7522c748b1548c14dcc88a4857ab963d7fe66e84.tar.gz cpython-7522c748b1548c14dcc88a4857ab963d7fe66e84.tar.bz2 |
Merged revisions 68779 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68779 | benjamin.peterson | 2009-01-19 11:37:42 -0600 (Mon, 19 Jan 2009) | 1 line
make bad file descriptor tests more robust
........
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r-- | Lib/test/support.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py index 5f8b1ba..68791d5 100644 --- a/Lib/test/support.py +++ b/Lib/test/support.py @@ -344,6 +344,18 @@ def sortdict(dict): withcommas = ", ".join(reprpairs) return "{%s}" % withcommas +def make_bad_fd(): + """ + Create an invalid file descriptor by opening and closing a file and return + its fd. + """ + file = open(TESTFN, "wb") + try: + return file.fileno() + finally: + file.close() + unlink(TESTFN) + def check_syntax_error(testcase, statement): try: compile(statement, '<test string>', 'exec') |