Switch to range from xrange for python 3 compatibility
xrange no longer exists in python 3, and since it is a small number of iterations there is a limited performance impact under python 2 by using range instead. Add check to ensure linearisation exception does not occur under python 3, due to exception in attempting to use a non existing function. Change-Id: I3e6165b8bce14a44459fc9419792784f64636f5e
This commit is contained in:
@@ -237,7 +237,7 @@ class ImportUpstream(LogDedentMixin, GitMixin):
|
|||||||
ancestors.add(root)
|
ancestors.add(root)
|
||||||
|
|
||||||
# look for merge commits that are not part of ancestry path
|
# look for merge commits that are not part of ancestry path
|
||||||
for idx in xrange(counter - 1, -1, -1):
|
for idx in range(counter - 1, -1, -1):
|
||||||
commit = sequence[idx]
|
commit = sequence[idx]
|
||||||
# if there is only one parent, no need to check the others
|
# if there is only one parent, no need to check the others
|
||||||
if len(commit.parents) < 2:
|
if len(commit.parents) < 2:
|
||||||
|
@@ -67,6 +67,10 @@ class TestImportCommand(TestWithScenarios, BaseTestCase):
|
|||||||
self.assertThat(self.logger.output,
|
self.assertThat(self.logger.output,
|
||||||
Contains("Starting execution of import command"))
|
Contains("Starting execution of import command"))
|
||||||
|
|
||||||
|
self.assertThat(
|
||||||
|
self.logger.output,
|
||||||
|
Not(Contains("Exception occurred during linearisation")))
|
||||||
|
|
||||||
# perform sanity checks on results
|
# perform sanity checks on results
|
||||||
self._check_tree_state()
|
self._check_tree_state()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user