summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-01-06 04:18:21 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-01-06 04:18:21 (GMT)
commit9f39f6853342df9af677810f65f655cc58c20986 (patch)
tree4516ef85cb6941aeeaa32e55516d6f66b4439677
parenta9652f11ade5566c2429fb16902fe1cc3f2f1f70 (diff)
downloadcpython-9f39f6853342df9af677810f65f655cc58c20986.zip
cpython-9f39f6853342df9af677810f65f655cc58c20986.tar.gz
cpython-9f39f6853342df9af677810f65f655cc58c20986.tar.bz2
initscr() will exit if there's an error. Try to catch the obvious failure
cases if TERM isn't set or is unknown (perhaps we should only check if unset or empty?) Skip the test if TERM isn't set. This seems to occur when running under buildbot and presumably cron. For some more info check here: http://mail.python.org/pipermail/python-checkins/2006-January/048704.html Will backport if it works.
-rw-r--r--Lib/test/test_curses.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py
index 7481642..e137d31 100644
--- a/Lib/test/test_curses.py
+++ b/Lib/test/test_curses.py
@@ -14,10 +14,13 @@ import curses, sys, tempfile, os
# 'curses' resource be given on the regrtest command line using the -u
# option. If not available, nothing after this line will be executed.
-from test import test_support
-test_support.requires('curses')
-if not os.isatty(sys.stdin.fileno()):
- raise test_support.TestSkipped, "stdin is not a tty"
+from test.test_support import requires, TestSkipped
+requires('curses')
+
+# XXX: if newterm was supported we could use it instead of initscr and not exit
+term = os.environ.get('TERM')
+if not term or term == 'unknown':
+ raise TestSkipped, "$TERM=%r, calling initscr() may cause exit" % term
def window_funcs(stdscr):
"Test the methods of windows"