More compatibility with Python 3

- use the six version of configparser and urllib, and depends on six;
- remove relative imports;
- adapt few tests to the changes.

The changes above should be noop from the point of view of
functionalities, at least on python 2.

And also:
- replace the py34 tox virtualenv with py35;
- add a non-voting py35 job (locally for now, it will be enabled
  to project-config also for gating when stable).

Story: 2002574
Task: 22142
Change-Id: I0a35abaae6f5b7095ebae765fbe2163046e0a4da
This commit is contained in:
Luigi Toscano
2018-06-26 23:20:52 +02:00
parent 16f0a1c66e
commit cdbc98572d
19 changed files with 81 additions and 65 deletions

View File

@@ -15,12 +15,13 @@
import os
import shutil
import urllib2
from base import VersionedService
from config_tempest.constants import LOG
from six.moves import urllib
from tempest.lib import exceptions
from config_tempest.constants import LOG
from config_tempest.services.base import VersionedService
class ImageService(VersionedService):
@@ -173,7 +174,7 @@ class ImageService(VersionedService):
LOG.info("Image '%s' already fetched to '%s'.", url, destination)
return
LOG.info("Downloading '%s' and saving as '%s'", url, destination)
f = urllib2.urlopen(url)
f = urllib.request.urlopen(url)
data = f.read()
with open(destination, "wb") as dest:
dest.write(data)