[wwwsearch-commits] r25430 - wwwsearch/ClientCookie/trunk/test

jjlee at codespeak.net jjlee at codespeak.net
Thu Apr 6 01:12:34 CEST 2006


Author: jjlee
Date: Thu Apr  6 01:12:32 2006
New Revision: 25430

Modified:
   wwwsearch/ClientCookie/trunk/test/test_headers.py
   wwwsearch/ClientCookie/trunk/test/test_urllib2.py
Log:
Silence one gaierror that has showed up in tests for ages on some machines (another is fixed in stdlib for 2.5); Fix old-Python backwards-compatibility test failure

Modified: wwwsearch/ClientCookie/trunk/test/test_headers.py
==============================================================================
--- wwwsearch/ClientCookie/trunk/test/test_headers.py	(original)
+++ wwwsearch/ClientCookie/trunk/test/test_headers.py	Thu Apr  6 01:12:32 2006
@@ -2,6 +2,11 @@
 
 from unittest import TestCase
 
+try: True
+except NameError:
+    True = 1
+    False = 0
+
 class IsHtmlTests(TestCase):
     def test_is_html(self):
         from ClientCookie._HeadersUtil import is_html

Modified: wwwsearch/ClientCookie/trunk/test/test_urllib2.py
==============================================================================
--- wwwsearch/ClientCookie/trunk/test/test_urllib2.py	(original)
+++ wwwsearch/ClientCookie/trunk/test/test_urllib2.py	Thu Apr  6 01:12:32 2006
@@ -370,12 +370,15 @@
             TESTFN = "test.txt"
             urlpath = sanepathname2url(os.path.abspath(TESTFN))
             towrite = "hello, world\n"
+            try:
+                fqdn = socket.gethostbyname(socket.gethostname())
+            except socket.gaierror:
+                fqdn = "localhost"
             for url in [
                 "file://localhost%s" % urlpath,
                 "file://%s" % urlpath,
                 "file://%s%s" % (socket.gethostbyname('localhost'), urlpath),
-                "file://%s%s" % (socket.gethostbyname(socket.gethostname()),
-                                 urlpath),
+                "file://%s%s" % (fqdn, urlpath)
                 ]:
                 f = open(TESTFN, "wb")
                 try:


More information about the wwwsearch-commits mailing list