commit b96dcd2df0d9a1638d450f008f3134206cf7e85a
Author: Arturo Filastò <art(a)fuffa.org>
Date: Fri Mar 28 01:44:53 2014 +0100
Only print out a summary when it's appropriate.
Replace prints with log.msg
---
ooni/nettest.py | 2 ++
ooni/nettests/blocking/bridge_reachability.py | 12 ++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/ooni/nettest.py b/ooni/nettest.py
index 074f0bd..fb0bf95 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -440,6 +440,8 @@ class NetTest(object):
return ' '.join(tc.name for tc, _ in self.testCases)
def doneNetTest(self, result):
+ if not self.summary:
+ return
print "Summary for %s" % self.testDetails['test_name']
print "------------" + "-"*len(self.testDetails['test_name'])
for test_class in self.testClasses:
diff --git a/ooni/nettests/blocking/bridge_reachability.py b/ooni/nettests/blocking/bridge_reachability.py
index c191804..d8efb70 100644
--- a/ooni/nettests/blocking/bridge_reachability.py
+++ b/ooni/nettests/blocking/bridge_reachability.py
@@ -88,16 +88,16 @@ class BridgeReachability(nettest.NetTestCase):
working_bridges = ', '.join(["%s %s" % (x['transport_name'], x['address']) for x in summary['successes']])
failing_bridges = ', '.join(["%s %s (at %s%%)" % (x['transport_name'], x['address'], x['tor_progress']) for x in summary['failures']])
- print "Total successes: %d" % len(summary['successes'])
- print "Total failures: %d" % len(summary['failures'])
+ log.msg("Total successes: %d" % len(summary['successes']))
+ log.msg("Total failures: %d" % len(summary['failures']))
for transport, count in successful_count.items():
- print "%s successes: %d" % (transport.title(), count)
+ log.msg("%s successes: %d" % (transport.title(), count))
for transport, count in failure_count.items():
- print "%s failures: %d" % (transport.title(), count)
+ log.msg("%s failures: %d" % (transport.title(), count))
- print "Working bridges: %s" % working_bridges
- print "Failing bridges: %s" % failing_bridges
+ log.msg("Working bridges: %s" % working_bridges)
+ log.msg("Failing bridges: %s" % failing_bridges)
def test_full_tor_connection(self):
config = txtorcon.TorConfig()