diff options
| author | Benjamin Peterson <benjamin@python.org> | 2009-01-19 21:02:45 (GMT) |
|---|---|---|
| committer | Benjamin Peterson <benjamin@python.org> | 2009-01-19 21:02:45 (GMT) |
| commit | 29d93816259cb5606a9a749a965e1e9862b3a4f5 (patch) | |
| tree | 2e3735216f1de31afb5325338cbe06a4f6e58a2e /Lib/test/test_support.py | |
| parent | 61b8e940f38feeb23035e67f2b79c433417cb088 (diff) | |
| download | cpython-29d93816259cb5606a9a749a965e1e9862b3a4f5.zip cpython-29d93816259cb5606a9a749a965e1e9862b3a4f5.tar.gz cpython-29d93816259cb5606a9a749a965e1e9862b3a4f5.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/test_support.py')
| -rw-r--r-- | Lib/test/test_support.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index abaf117..5186a57 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -357,6 +357,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') |
