test_iputil.py: repair a test for cygwin (which is intended to behave differently).
authorDaira Hopwood <david-sarah@jacaranda.org>
Tue, 25 Jun 2013 22:32:02 +0000 (23:32 +0100)
committerDaira Hopwood <david-sarah@jacaranda.org>
Tue, 25 Jun 2013 22:32:02 +0000 (23:32 +0100)
Signed-off-by: Daira Hopwood <david-sarah@jacaranda.org>
src/allmydata/test/test_iputil.py

index 00359a428e98ae734860bcf3d592a40e4d88852a..b89f43a573cb0aaf0738996af5aa98b303bd37e5 100644 (file)
@@ -1,5 +1,5 @@
 
-import re, errno, subprocess, os
+import re, errno, subprocess, os, sys
 
 from twisted.trial import unittest
 
@@ -105,12 +105,19 @@ class ListAddresses(testutil.SignalMixin, unittest.TestCase):
         self.patch(subprocess, 'Popen', call_Popen)
 
         def call_get_local_ip_for(target):
-            return "192.168.0.10"
+            if target in ("localhost", "127.0.0.1"):
+                return "127.0.0.1"
+            else:
+                return "192.168.0.10"
         self.patch(iputil, 'get_local_ip_for', call_get_local_ip_for)
 
         d = iputil.get_local_addresses_async()
         def _check(addresses):
-            self.failUnlessEquals(set(addresses), set(["127.0.0.1", "192.168.0.6", "192.168.0.2", "192.168.0.10"]))
+            if sys.platform == "cygwin":
+                expected = set(["127.0.0.1", "192.168.0.10"])
+            else:
+                expected = set(["127.0.0.1", "192.168.0.6", "192.168.0.2", "192.168.0.10"])
+            self.failUnlessEquals(set(addresses), expected)
         d.addCallbacks(_check)
         return d