[py-svn] r62984 - in py/trunk/py/test/dsession: . testing

hpk at codespeak.net hpk at codespeak.net
Tue Mar 17 08:19:24 CET 2009


Author: hpk
Date: Tue Mar 17 08:19:23 2009
New Revision: 62984

Modified:
   py/trunk/py/test/dsession/dsession.py
   py/trunk/py/test/dsession/testing/test_dsession.py
Log:
allow for host to go down if it didn't go up yet


Modified: py/trunk/py/test/dsession/dsession.py
==============================================================================
--- py/trunk/py/test/dsession/dsession.py	(original)
+++ py/trunk/py/test/dsession/dsession.py	Tue Mar 17 08:19:23 2009
@@ -170,7 +170,11 @@
         self.host2pending[host] = []
 
     def removehost(self, host):
-        pending = self.host2pending.pop(host)
+        try:
+            pending = self.host2pending.pop(host)
+        except KeyError:
+            # this happens if we didn't receive a hostup event yet
+            return []
         for item in pending:
             del self.item2host[item]
         return pending

Modified: py/trunk/py/test/dsession/testing/test_dsession.py
==============================================================================
--- py/trunk/py/test/dsession/testing/test_dsession.py	(original)
+++ py/trunk/py/test/dsession/testing/test_dsession.py	Tue Mar 17 08:19:23 2009
@@ -47,7 +47,8 @@
         pending = session.removehost(host)
         assert pending == [item]
         assert item not in session.item2host
-        py.test.raises(Exception, "session.removehost(host)")
+        l = session.removehost(host)
+        assert not l 
 
     def test_senditems_removeitems(self, testdir):
         item = testdir.getitem("def test_func(): pass")



More information about the pytest-commit mailing list