Python 3 Fix: use six.moves.urillib
Use six.moves.urllib instead of urllib2 for python 3 compatability.
Change-Id: Ia12a91d6164cd32080bafdeb5f4829e2d35f5e83
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 053b1cc..ea512a2 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -20,11 +20,10 @@
import re
import shutil
import time
-import urllib
-import urllib2
import yaml
import git
+from six.moves import urllib
import testtools
import zuul.change_matcher
@@ -2275,8 +2274,8 @@
port = self.webapp.server.socket.getsockname()[1]
- req = urllib2.Request("http://localhost:%s/status.json" % port)
- f = urllib2.urlopen(req)
+ req = urllib.request.Request("http://localhost:%s/status.json" % port)
+ f = urllib.request.urlopen(req)
headers = f.info()
self.assertIn('Content-Length', headers)
self.assertIn('Content-Type', headers)
@@ -2881,7 +2880,8 @@
port = self.webapp.server.socket.getsockname()[1]
- f = urllib.urlopen("http://localhost:%s/status.json" % port)
+ req = urllib.request.Request("http://localhost:%s/status.json" % port)
+ f = urllib.request.urlopen(req)
data = f.read()
self.worker.hold_jobs_in_build = False