Change in vdsm[master]: tests: Use integer division for array index in SchedulerTests

mzamazal at redhat.com mzamazal at redhat.com
Fri Apr 8 13:45:45 UTC 2016


Milan Zamazal has uploaded a new change for review.

Change subject: tests: Use integer division for array index in SchedulerTests
......................................................................

tests: Use integer division for array index in SchedulerTests

In Python 3 the standard division operator may produce non-integer
result even when both the operands are integers.  We should use //
operator instead, which always produces integer result in both Python 2
and Python 3.

This fixes one of the Vdsm test breakages with Python 3, when running
`make check-all'.

Change-Id: Id3ae8d93644547e85425611ce340b9f91d20159b
Signed-off-by: Milan Zamazal <mzamazal at redhat.com>
---
M tests/scheduleTests.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/70/55870/1

diff --git a/tests/scheduleTests.py b/tests/scheduleTests.py
index c860eea..750f609 100644
--- a/tests/scheduleTests.py
+++ b/tests/scheduleTests.py
@@ -157,7 +157,7 @@
             ticker.latency.sort()
             min = ticker.latency[0]
             avg = sum(ticker.latency) / len(ticker.latency)
-            med = ticker.latency[len(ticker.latency) / 2]
+            med = ticker.latency[len(ticker.latency) // 2]
             max = ticker.latency[-1]
             print('latency - avg: %.3f min: %.3f median: %.3f max: %.3f' % (
                 avg, min, med, max))


-- 
To view, visit https://gerrit.ovirt.org/55870
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3ae8d93644547e85425611ce340b9f91d20159b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Milan Zamazal <mzamazal at redhat.com>


More information about the vdsm-patches mailing list