From e6fe480a306a875d94609e04954c3cb04f0e0dd9 Mon Sep 17 00:00:00 2001 From: Brian O'Connor <bocon13@gmail.com> Date: Tue, 10 Sep 2013 15:32:03 -0700 Subject: [PATCH] cleaned up and commented test_limit.py --- examples/test/test_limit.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/test/test_limit.py b/examples/test/test_limit.py index 2629d1f8..ea5ce355 100755 --- a/examples/test/test_limit.py +++ b/examples/test/test_limit.py @@ -1,19 +1,20 @@ #!/usr/bin/env python -"""TEST""" +""" +Test for limit.py +""" import unittest import pexpect -from mininet.log import setLogLevel class testLimit( unittest.TestCase ): - "Test ping with single switch topology (common code)." def testLimit( self ): + "Verify that CPU limits are within a 1% tolerance of limit for each scheduler" + p = pexpect.spawn( 'python -m mininet.examples.limit' ) opts = [ '\*\*\* Testing network ([\d\.]+) Mbps', '\*\*\* Results: \[([\d\., ]+)\]', pexpect.EOF ] - p = pexpect.spawn( 'python -m mininet.examples.limit' ) count = 0 bw = 0 tolerance = 1 @@ -24,15 +25,14 @@ def testLimit( self ): count += 1 elif index == 1: results = p.match.group( 1 ) - for x in results.split(','): + for x in results.split( ',' ): result = float( x ) self.assertTrue( result < bw + tolerance ) - self.assertTrue( result > bw - tolerance) + self.assertTrue( result > bw - tolerance ) else: break self.assertTrue( count > 0 ) if __name__ == '__main__': - setLogLevel( 'warning' ) unittest.main() -- GitLab