From 7e43c499edad226575d93679ad201ba8ea02c340 Mon Sep 17 00:00:00 2001 From: "A. Jesse Jiryu Davis" Date: Thu, 15 Aug 2013 12:15:49 -0400 Subject: [PATCH] Style. --- .../mod_wsgi_test_replica_set.wsgi | 2 +- .../mod_wsgi_test_single_server.wsgi | 2 +- test/mod_wsgi_test/test_client.py | 23 +++++++++++-------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/test/mod_wsgi_test/mod_wsgi_test_replica_set.wsgi b/test/mod_wsgi_test/mod_wsgi_test_replica_set.wsgi index 967ee3a67..7704baee7 100644 --- a/test/mod_wsgi_test/mod_wsgi_test_replica_set.wsgi +++ b/test/mod_wsgi_test/mod_wsgi_test_replica_set.wsgi @@ -36,7 +36,7 @@ ndocs = 20 collection.drop() collection.insert([{'i': i} for i in range(ndocs)]) -client.disconnect() # discard main thread's request socket +client.disconnect() # Discard main thread's request socket. try: from mod_wsgi import version as mod_wsgi_version diff --git a/test/mod_wsgi_test/mod_wsgi_test_single_server.wsgi b/test/mod_wsgi_test/mod_wsgi_test_single_server.wsgi index fe42f6bff..1b39a0be9 100644 --- a/test/mod_wsgi_test/mod_wsgi_test_single_server.wsgi +++ b/test/mod_wsgi_test/mod_wsgi_test_single_server.wsgi @@ -35,7 +35,7 @@ ndocs = 20 collection.drop() collection.insert([{'i': i} for i in range(ndocs)]) -client.disconnect() # discard main thread's request socket +client.disconnect() # Discard main thread's request socket. try: from mod_wsgi import version as mod_wsgi_version diff --git a/test/mod_wsgi_test/test_client.py b/test/mod_wsgi_test/test_client.py index 137f5fa28..c805dba11 100644 --- a/test/mod_wsgi_test/test_client.py +++ b/test/mod_wsgi_test/test_client.py @@ -31,19 +31,23 @@ def parse_args(): # Should be enough that any connection leak will exhaust available file # descriptors. - parser.add_option("-n", "--nrequests", type="int", + parser.add_option( + "-n", "--nrequests", type="int", dest="nrequests", default=50 * 1000, help="Number of times to GET the URL, in total") - parser.add_option("-t", "--nthreads", type="int", + parser.add_option( + "-t", "--nthreads", type="int", dest="nthreads", default=100, help="Number of threads with mode 'parallel'") - parser.add_option("-q", "--quiet", + parser.add_option( + "-q", "--quiet", action="store_false", dest="verbose", default=True, help="Don't print status messages to stdout") - parser.add_option("-c", "--continue", + parser.add_option( + "-c", "--continue", action="store_true", dest="continue_", default=False, help="Continue after HTTP errors") @@ -65,7 +69,7 @@ def get(url): class URLGetterThread(threading.Thread): - # class variables + # Class variables. counter_lock = threading.Lock() counter = 0 @@ -107,12 +111,11 @@ def main(options, mode, url): nrequests_per_thread = options.nrequests / options.nthreads if options.verbose: - print ('Getting %s %s times total in %s threads, ' + print ( + 'Getting %s %s times total in %s threads, ' '%s times per thread' % ( - url, nrequests_per_thread * options.nthreads, options.nthreads, - nrequests_per_thread - )) - + url, nrequests_per_thread * options.nthreads, + options.nthreads, nrequests_per_thread)) threads = [ URLGetterThread(options, url, nrequests_per_thread) for _ in range(options.nthreads)