Rev 6604: (vila) Fix test failures blocking package builds. (Vincent Ladeuil) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 10 08:17:54 UTC 2015


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6604 [merge]
revision-id: pqm at pqm.ubuntu.com-20150910081753-773xpy9je7uafytx
parent: pqm at pqm.ubuntu.com-20150421053233-x63rhby1q3612v2h
parent: v.ladeuil+lp at free.fr-20150908075937-u63hgo67v3c2lapt
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2015-09-10 08:17:53 +0000
message:
  (vila) Fix test failures blocking package builds. (Vincent Ladeuil)
modified:
  bzrlib/tests/test_http.py      testhttp.py-20051018020158-b2eef6e867c514d9
  bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
  bzrlib/tests/test_urlutils.py  test_urlutils.py-20060502192900-46b1f9579987cf9c
  doc/en/release-notes/bzr-2.7.txt bzr2.7.txt-20130727124539-wnx897hy9l2h9f7x-1
=== modified file 'bzrlib/tests/test_http.py'
--- a/bzrlib/tests/test_http.py	2012-09-17 06:58:15 +0000
+++ b/bzrlib/tests/test_http.py	2015-09-06 16:10:26 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2011 Canonical Ltd
+# Copyright (C) 2005-2012, 2015 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -656,13 +656,28 @@
 
     _req_handler_class = BadStatusRequestHandler
 
+    def setUp(self):
+        super(TestBadStatusServer, self).setUp()
+        # See https://bugs.launchpad.net/bzr/+bug/1451448 for details.
+        # TD;LR: Running both a TCP client and server in the same process and
+        # thread uncovers a race in python. The fix is to run the server in a
+        # different process. Trying to fix yet another race here is not worth
+        # the effort. -- vila 2015-09-06
+        if 'HTTP/1.0' in self.id():
+            raise tests.TestSkipped(
+                'Client/Server in the same process and thread can hang')
+
     def test_http_has(self):
         t = self.get_readonly_transport()
-        self.assertRaises(errors.InvalidHttpResponse, t.has, 'foo/bar')
+        self.assertRaises((errors.ConnectionError, errors.ConnectionReset,
+                           errors.InvalidHttpResponse),
+                          t.has, 'foo/bar')
 
     def test_http_get(self):
         t = self.get_readonly_transport()
-        self.assertRaises(errors.InvalidHttpResponse, t.get, 'foo/bar')
+        self.assertRaises((errors.ConnectionError, errors.ConnectionReset,
+                           errors.InvalidHttpResponse),
+                          t.get, 'foo/bar')
 
 
 class InvalidStatusRequestHandler(http_server.TestingHTTPRequestHandler):

=== modified file 'bzrlib/tests/test_osutils.py'
--- a/bzrlib/tests/test_osutils.py	2014-04-09 08:05:23 +0000
+++ b/bzrlib/tests/test_osutils.py	2015-09-06 16:23:59 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2011 Canonical Ltd
+# Copyright (C) 2005-2015 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -925,6 +925,7 @@
     """Test that _win32 versions of os utilities return appropriate paths."""
 
     def test_abspath(self):
+        self.requireFeature(features.win32_feature)
         self.assertEqual('C:/foo', osutils._win32_abspath('C:\\foo'))
         self.assertEqual('C:/foo', osutils._win32_abspath('C:/foo'))
         self.assertEqual('//HOST/path', osutils._win32_abspath(r'\\HOST\path'))
@@ -977,6 +978,7 @@
         self.assertEqual('C:\\foo', osutils._win32_fixdrive('c:\\foo'))
 
     def test_win98_abspath(self):
+        self.requireFeature(features.win32_feature)
         # absolute path
         self.assertEqual('C:/foo', osutils._win98_abspath('C:\\foo'))
         self.assertEqual('C:/foo', osutils._win98_abspath('C:/foo'))

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2011-12-14 19:44:40 +0000
+++ b/bzrlib/tests/test_transport.py	2015-09-08 07:59:37 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005-2011 Canonical Ltd
+# Copyright (C) 2005-2011, 2015 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -815,6 +815,7 @@
 class TestWin32LocalTransport(tests.TestCase):
 
     def test_unc_clone_to_root(self):
+        self.requireFeature(features.win32_feature)
         # Win32 UNC path like \\HOST\path
         # clone to root should stop at least at \\HOST part
         # not on \\

=== modified file 'bzrlib/tests/test_urlutils.py'
--- a/bzrlib/tests/test_urlutils.py	2012-01-05 13:02:31 +0000
+++ b/bzrlib/tests/test_urlutils.py	2015-09-06 16:23:59 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2012 Canonical Ltd
+# Copyright (C) 2006-2012, 2015 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
     InvalidRebaseURLs,
     PathNotChild,
     )
-from bzrlib.tests import TestCaseInTempDir, TestCase, TestSkipped
+from bzrlib.tests import features, TestCaseInTempDir, TestCase, TestSkipped
 
 
 class TestUrlToPath(TestCase):
@@ -411,6 +411,7 @@
         self.assertFalse(isinstance(result, unicode))
 
     def test_win32_unc_path_to_url(self):
+        self.requireFeature(features.win32_feature)
         to_url = urlutils._win32_local_path_to_url
         self.assertEqual('file://HOST/path',
             to_url(r'\\HOST\path'))

=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- a/doc/en/release-notes/bzr-2.7.txt	2014-12-15 20:24:42 +0000
+++ b/doc/en/release-notes/bzr-2.7.txt	2015-09-06 21:12:17 +0000
@@ -76,6 +76,11 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* Fix racy http tests (TestBadStatusServer is so simple, it exposes a race
+  in python 2.7.9. This happens only when both the http server and client
+  are run in the same process.). Only tests are affected.
+  (Vincent Ladeuil, #1451448)
+     
 * Fix warnings on stderr caused by the atexit handler triggering for the
   wrong reason: the 'config' command should explicitly save the changes when
   modifying or removing an option and not rely on the atexit
@@ -93,5 +98,9 @@
 * Restrict access to '.netrc' in tests or recent python (2.7.5-8) will
   complain. (Vincent Ladeuil, #1233413)
 
+* Skip windows-only tests that start failing with python 2.7.9, there is no
+  way to fix them without testing on windows itself.
+  (Vincent Ladeuil, #1451448)
+     
 ..
    vim: tw=74 ft=rst ff=unix




More information about the bazaar-commits mailing list