summaryrefslogtreecommitdiff
path: root/testenv/misc
diff options
context:
space:
mode:
authorDarshit Shah <darnir@gmail.com>2014-09-14 16:57:15 +0530
committerDarshit Shah <darnir@gmail.com>2014-09-14 16:57:15 +0530
commitaf702340a1f3b462d0224968602c2b2974f218d6 (patch)
treea1d352f6d30505ecc856d5b7561d4dc001b3a891 /testenv/misc
parent6140b1b6e3831a35fd2cf4536fda741a4dcc9019 (diff)
parentf8e9a64ec7445d22f67f1817043d5807c4766556 (diff)
downloadwget-parallel-wget.tar.gz
Merge remote-tracking branch 'origin/master' into parallel-wgetparallel-wget
Conflicts: src/http.c testenv/Makefile.am testenv/Test--https.py testenv/Test--spider-r.py testenv/Test-Content-disposition-2.py testenv/Test-Content-disposition.py testenv/Test-Head.py testenv/Test-O.py testenv/Test-Parallel-Proto.py testenv/Test-Post.py testenv/Test-Proto.py testenv/Test-auth-basic-fail.py testenv/Test-auth-basic.py testenv/Test-auth-both.py testenv/Test-auth-digest.py testenv/Test-auth-no-challenge-url.py testenv/Test-auth-no-challenge.py testenv/Test-auth-retcode.py testenv/Test-auth-with-content-disposition.py testenv/Test-c-full.py testenv/Test-cookie-401.py testenv/Test-cookie-domain-mismatch.py testenv/Test-cookie-expires.py testenv/Test-cookie.py testenv/conf/__init__.py testenv/conf/authentication.py testenv/conf/expect_header.py testenv/conf/expected_files.py testenv/conf/expected_ret_code.py testenv/conf/files_crawled.py testenv/conf/hook_sample.py testenv/conf/local_files.py testenv/conf/reject_header.py testenv/conf/response.py testenv/conf/send_header.py testenv/conf/server_files.py testenv/conf/urls.py testenv/conf/wget_commands.py testenv/misc/colour_terminal.py testenv/server/http/http_server.py testenv/test/base_test.py testenv/test/http_test.py
Diffstat (limited to 'testenv/misc')
-rw-r--r--testenv/misc/colour_terminal.py43
1 files changed, 29 insertions, 14 deletions
diff --git a/testenv/misc/colour_terminal.py b/testenv/misc/colour_terminal.py
index 206ffa30..cfbae94e 100644
--- a/testenv/misc/colour_terminal.py
+++ b/testenv/misc/colour_terminal.py
@@ -2,24 +2,39 @@ from functools import partial
import platform
from os import getenv
+""" This module allows printing coloured output to the terminal when running a
+Wget Test under certain conditions.
+The output is coloured only on Linux systems. This is because coloured output
+in the terminal on Windows requires too much effort for what is simply a
+convenience. This might work on OSX terminals, but without a confirmation, it
+remains unsupported.
+
+Another important aspect is that the coloured output is printed only if the
+environment variable MAKE_CHECK is not set. This variable is set when running
+the test suite through, `make check`. In that case, the output is not only
+printed to the terminal but also copied to a log file where the ANSI escape
+codes on;y add clutter. """
+
+
T_COLORS = {
- 'PURPLE' : '\033[95m',
- 'BLUE' : '\033[94m',
- 'GREEN' : '\033[92m',
- 'YELLOW' : '\033[93m',
- 'RED' : '\033[91m',
- 'ENDC' : '\033[0m'
+ 'PURPLE' : '\033[95m',
+ 'BLUE' : '\033[94m',
+ 'GREEN' : '\033[92m',
+ 'YELLOW' : '\033[93m',
+ 'RED' : '\033[91m',
+ 'ENDC' : '\033[0m'
}
+
def printer (color, string):
- if platform.system () == 'Linux':
- if getenv ("MAKE_CHECK", "False") == "True":
- print (string)
- else:
- print (T_COLORS.get (color) + string + T_COLORS.get ('ENDC'))
+ if platform.system () == 'Linux':
+ if getenv ("MAKE_CHECK", "False") == "True":
+ print (string)
+ else:
+ print (T_COLORS.get (color) + string + T_COLORS.get ('ENDC'))
- else:
- print (string)
+ else:
+ print (string)
print_blue = partial(printer, 'BLUE')
@@ -28,4 +43,4 @@ print_green = partial(printer, 'GREEN')
print_purple = partial(printer, 'PURPLE')
print_yellow = partial(printer, 'YELLOW')
-# vim: set ts=8 sw=3 tw=0 et :
+# vim: set ts=8 sw=3 tw=80 et :