From c14308f0faf2908217ce51a1641d89b6efebefce Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Thu, 2 Jan 2014 14:05:53 +0530 Subject: [PATCH 5/6] Sleep for n seconds before calling Wget Executable This commit adds support for a new Environment Variable, SERVER_WAIT which if set will cause the script to sleep for SERVER_WAIT seconds before calling the wget executable. During this period, the custom HTTP/HTTPS/FTP servers are all set up and running and can be used for any other purposes. This feature is often used when a separate executable must be used for testing apart from the one at src/wget --- testenv/ChangeLog | 5 +++++ testenv/WgetTest.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/testenv/ChangeLog b/testenv/ChangeLog index 68bd2ee..5f961c3 100644 --- a/testenv/ChangeLog +++ b/testenv/ChangeLog @@ -1,3 +1,8 @@ +2014-01-02 Darshit Shah + + * WgetTest.py (CommonMentods.exec_wget): Wait for n seconds before calling + the Wget executable. + 2013-12-27 Darshit Shah * WgetTest.py: Add modeline diff --git a/testenv/WgetTest.py b/testenv/WgetTest.py index a3458ed..dc1f0b4 100644 --- a/testenv/WgetTest.py +++ b/testenv/WgetTest.py @@ -5,6 +5,7 @@ import sys import traceback import HTTPServer import re +import time from subprocess import call from ColourTerm import printer from difflib import unified_diff @@ -40,6 +41,8 @@ class CommonMethods: cmd_line = self.get_cmd_line (options, urls, domain_list) params = shlex.split (cmd_line) print (params) + if os.getenv ("SERVER_WAIT"): + time.sleep (float (os.getenv ("SERVER_WAIT"))) try: retcode = call (params) except FileNotFoundError as filenotfound: -- 1.8.5.2