Fix version unit test on Python 3

With this change, "tox -e py34" now pass.

Changes:

* Replace unichr() with six.unichr()
* Replace StringIO.StringIO() with six.Bytes() in
  nova.crypto.generate_key_pair()
* On Python 3, replace UserDict.IterableUserDict with
  collections.UserDict
* Replace __builtin__.open with six.moves.builtins.open
* Replace ConfigParser import with six.moves.configparser
* On Python 3, get the original "queue" module instead of the "Queue"
  module in nova/virt/libvirt/host.py
* Replace urllib2 with six.moves.urllib
* tox.ini: "tox -e py34" now only runs nova.tests.unit.test_versions

Blueprint nova-python3
Change-Id: I056769c7c5b32276894f7aade8c0a27af81c42ae
This commit is contained in:
Victor Stinner
2015-05-25 13:22:29 +02:00
parent 52823c48ef
commit f0082849df
8 changed files with 26 additions and 17 deletions

View File

@@ -29,7 +29,7 @@ def _load_config():
# Don't load in global context, since we can't assume
# these modules are accessible when distutils uses
# this module
import ConfigParser
from six.moves import configparser
from oslo_config import cfg
@@ -46,7 +46,7 @@ def _load_config():
return
try:
cfg = ConfigParser.RawConfigParser()
cfg = configparser.RawConfigParser()
cfg.read(cfgfile)
if cfg.has_option("Nova", "vendor"):