summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py12
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')