[py-svn] r36966 - py/branch/config/py/test/rsession/testing

fijal at codespeak.net fijal at codespeak.net
Thu Jan 18 19:36:05 CET 2007


Author: fijal
Date: Thu Jan 18 19:36:02 2007
New Revision: 36966

Modified:
   py/branch/config/py/test/rsession/testing/test_rsession.py
Log:
Add try: finally:


Modified: py/branch/config/py/test/rsession/testing/test_rsession.py
==============================================================================
--- py/branch/config/py/test/rsession/testing/test_rsession.py	(original)
+++ py/branch/config/py/test/rsession/testing/test_rsession.py	Thu Jan 18 19:36:02 2007
@@ -229,29 +229,31 @@
         # we need to overwrite default list to serialize
         from py.__.test.rsession.master import defaultconftestnames
         defaultconftestnames.append("custom")
-        nodes = init_hosts(allevents.append, hosts, pkgdir, 
-            rsync_roots=["py"], config=config,
-            optimise_localhost=False)
-        
-        rootcol = py.test.collect.Directory(pkgdir.dirpath())
-        itempass = rootcol.getitembynames(funcoption_spec)
-        itempassaswell = rootcol.getitembynames(funcoptioncustom_spec)
-        
-        for node in nodes:
-            node.send(itempass)
-            node.send(itempassaswell)
-        
-        teardown_hosts(allevents.append, [node.channel for node in nodes], nodes)
-        events = [i for i in allevents 
-                        if isinstance(i, report.ReceivedItemOutcome)]
-        passed = [i for i in events 
-                        if i.outcome.passed]
-        skipped = [i for i in events 
-                        if i.outcome.skipped]
-        assert len(passed) == 2 * len(nodes)
-        assert len(skipped) == 0
-        assert len(events) == len(passed)
-        defaultconftestnames.remove("custom")
+        try:
+            nodes = init_hosts(allevents.append, hosts, pkgdir, 
+                rsync_roots=["py"], config=config,
+                optimise_localhost=False)
+
+            rootcol = py.test.collect.Directory(pkgdir.dirpath())
+            itempass = rootcol.getitembynames(funcoption_spec)
+            itempassaswell = rootcol.getitembynames(funcoptioncustom_spec)
+
+            for node in nodes:
+                node.send(itempass)
+                node.send(itempassaswell)
+
+            teardown_hosts(allevents.append, [node.channel for node in nodes], nodes)
+            events = [i for i in allevents 
+                            if isinstance(i, report.ReceivedItemOutcome)]
+            passed = [i for i in events 
+                            if i.outcome.passed]
+            skipped = [i for i in events 
+                            if i.outcome.skipped]
+            assert len(passed) == 2 * len(nodes)
+            assert len(skipped) == 0
+            assert len(events) == len(passed)
+        finally:
+            defaultconftestnames.remove("custom")
     
     def test_nice_level(self):
         """ Tests if nice level behaviour is ok



More information about the pytest-commit mailing list