Add cleanup

This commit is contained in:
Bob Lantz
2014-12-02 22:58:38 -08:00
parent b2fcab827d
commit c45bfab318
+7
View File
@@ -4,6 +4,7 @@
Test creation and all-pairs ping for each included mininet topo type.""" Test creation and all-pairs ping for each included mininet topo type."""
import unittest import unittest
import sys
from functools import partial from functools import partial
from mininet.net import Mininet from mininet.net import Mininet
@@ -12,6 +13,7 @@ from mininet.node import UserSwitch, OVSSwitch, IVSSwitch
from mininet.topo import SingleSwitchTopo, LinearTopo from mininet.topo import SingleSwitchTopo, LinearTopo
from mininet.log import setLogLevel from mininet.log import setLogLevel
from mininet.util import quietRun from mininet.util import quietRun
from mininet.clean import cleanup
# Tell pylint not to complain about calls to other class # Tell pylint not to complain about calls to other class
# pylint: disable=E1101 # pylint: disable=E1101
@@ -21,6 +23,11 @@ class testSingleSwitchCommon( object ):
switchClass = None # overridden in subclasses switchClass = None # overridden in subclasses
def tearDown( self ):
"Clean up if necessary"
if sys.exc_info != ( None, None, None ):
cleanup()
def testMinimal( self ): def testMinimal( self ):
"Ping test on minimal topology" "Ping test on minimal topology"
mn = Mininet( SingleSwitchTopo(), self.switchClass, Host, Controller, mn = Mininet( SingleSwitchTopo(), self.switchClass, Host, Controller,