Merge lp:~canonical-isd-hackers/canonical-identity-provider/silent-tests into lp:canonical-identity-provider/release

Proposed by Ricardo Kirkner
Status: Merged
Merged at revision: 11
Proposed branch: lp:~canonical-isd-hackers/canonical-identity-provider/silent-tests
Merge into: lp:canonical-identity-provider/release
Diff against target: 98 lines (+25/-1)
4 files modified
doctests/runner.py (+1/-1)
identityprovider/tests/utils.py (+4/-0)
mockservice/mockserver.py (+11/-0)
wsgi_test_server.py (+9/-0)
To merge this branch: bzr merge lp:~canonical-isd-hackers/canonical-identity-provider/silent-tests
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+25002@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

Now it looks OK.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'doctests/runner.py'
2--- doctests/runner.py 2010-04-21 15:29:24 +0000
3+++ doctests/runner.py 2010-05-10 15:41:28 +0000
4@@ -21,7 +21,7 @@
5 from setup import setUp
6
7 # Turn off logging
8-logging.basicConfig(filename='/dev/null')
9+logging.disable(logging.CRITICAL)
10
11
12 def myLoggingFunction(message, level=None):
13
14=== modified file 'identityprovider/tests/utils.py'
15--- identityprovider/tests/utils.py 2010-04-21 15:29:24 +0000
16+++ identityprovider/tests/utils.py 2010-05-10 15:41:28 +0000
17@@ -1,6 +1,7 @@
18 # Copyright 2010 Canonical Ltd. This software is licensed under the
19 # GNU Affero General Public License version 3 (see the file LICENSE).
20
21+import logging
22 import urllib
23 import urllib2
24 from cStringIO import StringIO
25@@ -219,6 +220,9 @@
26 """
27 raise
28
29+ # disable logging
30+ logging.disable(logging.CRITICAL)
31+
32 mockdb.fixate_connection(dsn)
33 result = TextTestRunner(verbosity=verbosity).run(suite)
34 mockdb.release_connection()
35
36=== modified file 'mockservice/mockserver.py'
37--- mockservice/mockserver.py 2010-04-21 15:29:24 +0000
38+++ mockservice/mockserver.py 2010-05-10 15:41:28 +0000
39@@ -275,7 +275,10 @@
40 return self.jsons('accounts')
41
42 if __name__ == '__main__':
43+ import logging
44 import optparse
45+ import sys
46+ from cStringIO import StringIO
47
48 parser = optparse.OptionParser()
49 parser.add_option("-H", "--host", help="Bind HOST [%default]",
50@@ -290,6 +293,14 @@
51 options, args = parser.parse_args()
52 server = Server(options.host, options.port, options.root)
53 httpd = make_server(options.host, options.port, server)
54+
55+ # disable logging
56+ logging.disable(logging.CRITICAL)
57+ # fake stderr to capture HTTPServer output
58+ # as .serve_forever() will never return until the process is killed, there
59+ # is no need nor reason for restoring stderr afterwards
60+ sys.stderr = StringIO()
61+
62 print "Serving on http://%s:%d%s..." % (httpd.server_name,
63 httpd.server_port,
64 options.root,)
65
66=== modified file 'wsgi_test_server.py'
67--- wsgi_test_server.py 2010-04-21 15:29:24 +0000
68+++ wsgi_test_server.py 2010-05-10 15:41:28 +0000
69@@ -4,6 +4,7 @@
70 # Run the app using this WSGI server to run the doctests.
71 # You'll need to make this accessible on port 80 for the tests to work.
72
73+import logging
74 import os
75 import signal
76 import sys
77@@ -11,6 +12,7 @@
78 if 'DJANGO_SETTINGS_MODULE' not in os.environ:
79 os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
80 import time
81+from cStringIO import StringIO
82
83 from django.conf import settings
84 from django.core import mail
85@@ -110,6 +112,13 @@
86 sys.exit(0)
87 signal.signal(signal.SIGTERM, signal_handler)
88
89+# disable logging
90+logging.disable(logging.CRITICAL)
91+# fake stderr to capture HTTPServer output
92+# as .serve_forever() will never return until the process is killed, there
93+# is no need nor reason for restoring stderr afterwards
94+sys.stderr = StringIO()
95+
96 print "Serving HTTP on port %s..." % server_port
97
98 # Respond to requests until process is killed