From e6e1260bc236b5261ae67566ee3453093fbdf5d0 Mon Sep 17 00:00:00 2001 From: Brian O'Connor <bocon13@gmail.com> Date: Tue, 10 Sep 2013 15:50:43 -0700 Subject: [PATCH] cleaned up and commented test_multiping.py --- examples/test/test_multiping.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/test/test_multiping.py b/examples/test/test_multiping.py index 1bd9f945..ff0571c6 100755 --- a/examples/test/test_multiping.py +++ b/examples/test/test_multiping.py @@ -1,21 +1,22 @@ #!/usr/bin/env python -"""TEST""" +""" +Test for multiping.py +""" import unittest import pexpect from collections import defaultdict -from mininet.log import setLogLevel class testMultiPing( unittest.TestCase ): - "Test ping with single switch topology (common code)." def testMultiPing( self ): + """Verify that each target is pinged at least once, and + that pings to 'real' targets are successful and unknown targets fail""" p = pexpect.spawn( 'python -m mininet.examples.multiping' ) - opts = [] - opts.append( "Host (h\d+) \(([\d.]+)\) will be pinging ips: ([\d. ]+)" ) - opts.append( "(h\d+): ([\d.]+) -> ([\d.]+) \d packets transmitted, (\d) received" ) - opts.append( pexpect.EOF ) + opts = [ "Host (h\d+) \(([\d.]+)\) will be pinging ips: ([\d\. ]+)", + "(h\d+): ([\d.]+) -> ([\d.]+) \d packets transmitted, (\d) received", + pexpect.EOF ] pings = defaultdict( list ) while True: index = p.expect( opts ) @@ -39,10 +40,9 @@ def testMultiPing( self ): pass else: break - self.assertTrue( len(pings) > 0 ) + self.assertTrue( len( pings ) > 0 ) for t in pings.values(): self.assertEqual( len( t ), 0 ) if __name__ == '__main__': - setLogLevel( 'warning' ) unittest.main() -- GitLab