mirror of
https://github.com/mirror/wget.git
synced 2025-01-27 12:50:13 +08:00
Create package misc, move ColourTerm.py to misc
delete mode 100644 testenv/ColourTerm.py create mode 100644 testenv/misc/__init__.py create mode 100644 testenv/misc/colour_terminal.py
This commit is contained in:
parent
df96c81cf3
commit
422171da81
@ -1,3 +1,15 @@
|
||||
2014-03-13 Zihang Chen <chsc4698@gmail.com>
|
||||
|
||||
* misc: (new package) package for miscellaneous modules
|
||||
* ColourTerm.py: Move to package misc and rename to colour_terminal.py,
|
||||
add print_color functions to reduce the use of string literals like
|
||||
"BLUE", "RED" etc.
|
||||
* WgetTest.py:
|
||||
(CommonMethods.Server_setup): Change invocation to printer to print_blue.
|
||||
(CommonMethods.FilesCrawled): Change invocation to printer to print_red.
|
||||
(HTTPTest.__init__): Change invocations to printer to print_red and
|
||||
print_green respectively.
|
||||
|
||||
2014-01-02 Darshit Shah <darnir@gmail.com>
|
||||
* Makefile.am: Add new Test--https.py to list of tests and EXTRA_DIST.
|
||||
Also replace all tabs with spaces in file for conformity.
|
||||
|
@ -10,7 +10,7 @@ Run the './configure' command to generate the Makefile and then run 'make check'
|
||||
to execute the Test Suite. Use the '-j n' option with 'make check' to execute
|
||||
n tests simultaneously.
|
||||
|
||||
File List:
|
||||
Structure:
|
||||
================================================================================
|
||||
|
||||
* HTTPServer.py: This file contains a custom, programmatically configurable
|
||||
@ -26,8 +26,11 @@ File List:
|
||||
the acceptable elements and their uses. Typically, one must copy this file
|
||||
and edit it for writing Test Cases.
|
||||
|
||||
* ColourTerm.py: A custom library for printing coloured output to the
|
||||
terminal. Currently it only supports 4 colours in a *nix environment.
|
||||
* misc: This package contains several helper modules used in this test
|
||||
suite.
|
||||
- colour_terminal.py: A custom module for printing coloured output to
|
||||
the terminal. Currently it only supports 4 colours in a *nix
|
||||
environment.
|
||||
|
||||
Working:
|
||||
================================================================================
|
||||
|
@ -7,7 +7,7 @@ import HTTPServer
|
||||
import re
|
||||
import time
|
||||
from subprocess import call
|
||||
from ColourTerm import printer
|
||||
from misc.colour_terminal import print_red, print_green, print_blue
|
||||
from difflib import unified_diff
|
||||
|
||||
HTTP = "HTTP"
|
||||
@ -213,7 +213,7 @@ class CommonMethods:
|
||||
o_headers = self.Request_remaining[i]
|
||||
header_diff = headers.symmetric_difference (o_headers)
|
||||
if len(header_diff) is not 0:
|
||||
printer ("RED", str (header_diff))
|
||||
print_red(header_diff)
|
||||
raise TestFailed ("Not all files were crawled correctly")
|
||||
|
||||
|
||||
@ -236,15 +236,15 @@ class HTTPTest (CommonMethods):
|
||||
try:
|
||||
self.Server_setup (name, pre_hook, test_params, post_hook, servers)
|
||||
except TestFailed as tf:
|
||||
printer ("RED", "Error: " + tf.error)
|
||||
print_red("Error: " + tf.error)
|
||||
self.tests_passed = False
|
||||
except Exception as ae:
|
||||
printer ("RED", "Unhandled Exception Caught.")
|
||||
print_red("Unhandled Exception Caught.")
|
||||
print ( ae.__str__ ())
|
||||
traceback.print_exc ()
|
||||
self.tests_passed = False
|
||||
else:
|
||||
printer ("GREEN", "Test Passed")
|
||||
print_green("Test Passed")
|
||||
finally:
|
||||
self._exit_test ()
|
||||
|
||||
@ -252,7 +252,7 @@ class HTTPTest (CommonMethods):
|
||||
self.name = name
|
||||
self.server_types = servers
|
||||
self.servers = len (servers)
|
||||
printer ("BLUE", "Running Test " + self.name)
|
||||
print_blue("Running Test " + self.name)
|
||||
self.init_test_env (name)
|
||||
self.server_list = list()
|
||||
self.domain_list = list()
|
||||
|
1
testenv/misc/__init__.py
Normal file
1
testenv/misc/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
|
@ -1,3 +1,4 @@
|
||||
from functools import partial
|
||||
import platform
|
||||
from os import getenv
|
||||
|
||||
@ -20,4 +21,11 @@ def printer (color, string):
|
||||
else:
|
||||
print (string)
|
||||
|
||||
|
||||
print_blue = partial(printer, 'BLUE')
|
||||
print_red = partial(printer, 'RED')
|
||||
print_green = partial(printer, 'GREEN')
|
||||
print_purple = partial(printer, 'PURPLE')
|
||||
print_yellow = partial(printer, 'YELLOW')
|
||||
|
||||
# vim: set ts=8 sw=3 tw=0 et :
|
Loading…
Reference in New Issue
Block a user