launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21315
[Merge] lp:~cjwatson/launchpad/subversion-1.9 into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/subversion-1.9 into lp:launchpad.
Commit message:
Fix code import tests to handle changes in Subversion 1.9.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/subversion-1.9/+merge/314556
Subversion 1.9 (in xenial) changes some error handling slightly in a way that broke tests.
While I was here, I arranged that any future problems of this form will at least not cause the test suite to hang with a dangling svnserve process.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/subversion-1.9 into lp:launchpad.
=== modified file 'lib/lp/codehosting/codeimport/tests/servers.py'
--- lib/lp/codehosting/codeimport/tests/servers.py 2016-11-14 18:29:17 +0000
+++ lib/lp/codehosting/codeimport/tests/servers.py 2017-01-11 18:41:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2016 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Server classes that know how to create various kinds of foreign archive."""
@@ -55,6 +55,7 @@
WSGIRequestHandlerLogger,
WSGIServerLogger,
)
+from subvertpy import SubversionException
import subvertpy.ra
import subvertpy.repos
@@ -130,14 +131,30 @@
delay = 0.1
for i in range(10):
try:
- self._get_ra(self.get_url())
- except OSError as e:
- if e.errno == errno.ECONNREFUSED:
- time.sleep(delay)
- delay *= 1.5
- continue
- else:
- break
+ try:
+ self._get_ra(self.get_url())
+ except OSError as e:
+ # Subversion < 1.9 just produces OSError.
+ if e.errno == errno.ECONNREFUSED:
+ time.sleep(delay)
+ delay *= 1.5
+ continue
+ raise
+ except SubversionException as e:
+ # Subversion >= 1.9 turns the raw error into a
+ # SubversionException. The code is
+ # SVN_ERR_RA_CANNOT_CREATE_SESSION, which is not yet
+ # in subvertpy.
+ if e.args[1] == 170013:
+ time.sleep(delay)
+ delay *= 1.5
+ continue
+ raise
+ else:
+ break
+ except Exception as e:
+ self._kill_svnserve()
+ raise
else:
self._kill_svnserve()
raise AssertionError(
Follow ups