From 9d14c841d7e675818bdacff66ae24dc355516ecd Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Tue, 27 Aug 2013 15:16:03 -0700 Subject: [PATCH] Pass code check --- mininet/test/test_hifi.py | 23 ++++++++++++++++------- mininet/test/test_nets.py | 9 +++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index f6ebb71..c9d288b 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -31,9 +31,12 @@ class SingleSwitchOptionsTopo(Topo): host = self.addHost('h%s' % (h + 1)) self.addLink(host, switch) +# Tell pylint not to complain about calls to other class +# pylint: disable=E1101 class testOptionsTopoCommon( object ): - "Verify ability to create networks with host and link options (common code)." + """Verify ability to create networks with host and link options + (common code).""" switchClass = None # overridden in subclasses @@ -41,7 +44,8 @@ class testOptionsTopoCommon( object ): "Generic topology-with-options test runner." mn = Mininet( topo=SingleSwitchOptionsTopo( n=n, hopts=hopts, lopts=lopts ), - host=CPULimitedHost, link=TCLink, switch=self.switchClass ) + host=CPULimitedHost, link=TCLink, + switch=self.switchClass ) dropped = mn.run( mn.ping ) self.assertEqual( dropped, 0 ) @@ -107,7 +111,8 @@ class testOptionsTopoCommon( object ): REPS = 1 lopts = { 'loss': LOSS_PERCENT, 'use_htb': True } mn = Mininet( topo=SingleSwitchOptionsTopo( n=N, lopts=lopts ), - host=CPULimitedHost, link=TCLink, switch=self.switchClass ) + host=CPULimitedHost, link=TCLink, + switch=self.switchClass ) # Drops are probabilistic, but the chance of no dropped packets is # 1 in 100 million with 4 hops for a link w/99% loss. dropped_total = 0 @@ -123,24 +128,28 @@ class testOptionsTopoCommon( object ): hopts = { 'cpu': 0.5 / N } self.runOptionsTopoTest( N, hopts=hopts, lopts=lopts ) +# pylint: enable=E1101 + class testOptionsTopoOVSKernel( testOptionsTopoCommon, unittest.TestCase ): - "Verify ability to create networks with host and link options (OVS kernel switch)." + """Verify ability to create networks with host and link options + (OVS kernel switch).""" switchClass = OVSSwitch @unittest.skip( 'Skipping OVS user switch test for now' ) class testOptionsTopoOVSUser( testOptionsTopoCommon, unittest.TestCase ): - "Verify ability to create networks with host and link options (OVS user switch)." + """Verify ability to create networks with host and link options + (OVS user switch).""" switchClass = partial( OVSSwitch, datapath='user' ) @unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS is not installed' ) class testOptionsTopoIVS( testOptionsTopoCommon, unittest.TestCase ): - "Verify ability to create networks with host and link options (IVS switch)." + "Verify ability to create networks with host and link options (IVS)." switchClass = IVSSwitch @unittest.skipUnless( quietRun( 'which ofprotocol' ), 'Reference user switch is not installed' ) class testOptionsTopoUserspace( testOptionsTopoCommon, unittest.TestCase ): - "Verify ability to create networks with host and link options (Userspace switch)." + "Verify ability to create networks with host and link options (UserSwitch)." switchClass = UserSwitch if __name__ == '__main__': diff --git a/mininet/test/test_nets.py b/mininet/test/test_nets.py index a56061b..9176646 100755 --- a/mininet/test/test_nets.py +++ b/mininet/test/test_nets.py @@ -13,6 +13,8 @@ from mininet.topo import SingleSwitchTopo, LinearTopo from mininet.log import setLogLevel from mininet.util import quietRun +# Tell pylint not to complain about calls to other class +# pylint: disable=E1101 class testSingleSwitchCommon( object ): "Test ping with single switch topology (common code)." @@ -31,6 +33,8 @@ class testSingleSwitchCommon( object ): dropped = mn.run( mn.ping ) self.assertEqual( dropped, 0 ) +# pylint: enable=E1101 + class testSingleSwitchOVSKernel( testSingleSwitchCommon, unittest.TestCase ): "Test ping with single switch topology (OVS kernel switch)." switchClass = OVSSwitch @@ -51,6 +55,9 @@ class testSingleSwitchUserspace( testSingleSwitchCommon, unittest.TestCase ): switchClass = UserSwitch +# Tell pylint not to complain about calls to other class +# pylint: disable=E1101 + class testLinearCommon( object ): "Test all-pairs ping with LinearNet (common code)." @@ -62,6 +69,8 @@ class testLinearCommon( object ): dropped = mn.run( mn.ping ) self.assertEqual( dropped, 0 ) +# pylint: enable=E1101 + class testLinearOVSKernel( testLinearCommon, unittest.TestCase ): "Test all-pairs ping with LinearNet (OVS kernel switch)."