From e508880579951767fe05ea7e68d0cb39b0f951e6 Mon Sep 17 00:00:00 2001 From: Joshua Hesketh Date: Wed, 14 Mar 2018 22:52:28 +1100 Subject: [PATCH] Decode gearman function into utf Previously the test was trying to cast the binary string into a string which in python3 still returns a binary string. As such the following startswith would not match as it was doing b'merger:cat'.startswith('merger:'). Fix the test by decoding into UTF-8 Change-Id: I794af9f88dcdf0b697249a8e372ad08d6b154315 --- tests/unit/test_scheduler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py index 4331959f70..0c4b3424dd 100755 --- a/tests/unit/test_scheduler.py +++ b/tests/unit/test_scheduler.py @@ -166,7 +166,7 @@ class TestScheduler(ZuulTestCase): "Test the correct variant of a job runs on a branch" self._startMerger() for f in list(self.executor_server.merger_worker.functions.keys()): - f = str(f) + f = f.decode('utf8') if f.startswith('merger:'): self.executor_server.merger_worker.unRegisterFunction(f)