From c45bfab318075f1634a048d18f718f21d3fee827 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Tue, 2 Dec 2014 22:58:38 -0800
Subject: [PATCH] Add cleanup

---
 mininet/test/test_nets.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mininet/test/test_nets.py b/mininet/test/test_nets.py
index 1a199c82..97c41488 100755
--- a/mininet/test/test_nets.py
+++ b/mininet/test/test_nets.py
@@ -4,6 +4,7 @@
    Test creation and all-pairs ping for each included mininet topo type."""
 
 import unittest
+import sys
 from functools import partial
 
 from mininet.net import Mininet
@@ -12,6 +13,7 @@
 from mininet.topo import SingleSwitchTopo, LinearTopo
 from mininet.log import setLogLevel
 from mininet.util import quietRun
+from mininet.clean import cleanup
 
 # Tell pylint not to complain about calls to other class
 # pylint: disable=E1101
@@ -21,6 +23,11 @@ class testSingleSwitchCommon( object ):
 
     switchClass = None # overridden in subclasses
 
+    def tearDown( self ):
+        "Clean up if necessary"
+        if sys.exc_info != ( None, None, None ):
+            cleanup()
+
     def testMinimal( self ):
         "Ping test on minimal topology"
         mn = Mininet( SingleSwitchTopo(), self.switchClass, Host, Controller,
-- 
GitLab