From f97b8e5e1df75284aa9b89dd830f8728040eab67 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 25 Jun 2013 23:32:02 +0100 Subject: [PATCH] test_iputil.py: repair a test for cygwin (which is intended to behave differently). Signed-off-by: Daira Hopwood --- src/allmydata/test/test_iputil.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/allmydata/test/test_iputil.py b/src/allmydata/test/test_iputil.py index 00359a42..b89f43a5 100644 --- a/src/allmydata/test/test_iputil.py +++ b/src/allmydata/test/test_iputil.py @@ -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 -- 2.45.2