diff options
author | Stephen D. Huston <shuston@apache.org> | 2009-10-05 23:35:23 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2009-10-05 23:35:23 +0000 |
commit | 9c5296bbd4adde01e85b97c43de23149779ae3ad (patch) | |
tree | 1a52912058683bf352b611affd6413487f8a69e0 /python/qpid-python-test | |
parent | 87258f571db29fa78f257281d3cfa1d1bd62a01a (diff) | |
download | qpid-python-9c5296bbd4adde01e85b97c43de23149779ae3ad.tar.gz |
Get remaining tests running on Windows
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@822091 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid-python-test')
-rwxr-xr-x | python/qpid-python-test | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/python/qpid-python-test b/python/qpid-python-test index 528acaa124..b569020368 100755 --- a/python/qpid-python-test +++ b/python/qpid-python-test @@ -20,7 +20,7 @@ # TODO: summarize, test harness preconditions (e.g. broker is alive) -import fcntl, logging, optparse, os, struct, sys, termios, traceback, types +import logging, optparse, os, struct, sys, traceback, types from fnmatch import fnmatchcase as match from getopt import GetoptError from logging import getLogger, StreamHandler, Formatter, Filter, \ @@ -126,27 +126,33 @@ def is_included(path): def is_smart(): return sys.stdout.isatty() and os.environ.get("TERM", "dumb") != "dumb" -def width(): - if is_smart(): - s = struct.pack("HHHH", 0, 0, 0, 0) - fd_stdout = sys.stdout.fileno() - x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s) - rows, cols, xpx, ypx = struct.unpack("HHHH", x) - return cols - else: - try: - return int(os.environ.get("COLUMNS", "80")) - except ValueError: - return 80 +try: + import fcntl, termios -WIDTH = width() + def width(): + if is_smart(): + s = struct.pack("HHHH", 0, 0, 0, 0) + fd_stdout = sys.stdout.fileno() + x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s) + rows, cols, xpx, ypx = struct.unpack("HHHH", x) + return cols + else: + try: + return int(os.environ.get("COLUMNS", "80")) + except ValueError: + return 80 -def resize(sig, frm): - global WIDTH WIDTH = width() -import signal -signal.signal(signal.SIGWINCH, resize) + def resize(sig, frm): + global WIDTH + WIDTH = width() + + import signal + signal.signal(signal.SIGWINCH, resize) + +except ImportError: + WIDTH = 80 def vt100_attrs(*attrs): return "\x1B[%sm" % ";".join(map(str, attrs)) |