"""
from __future__ import print_function
-import ConfigParser
+from six.moves import configparser as ConfigParser
import json
import os
import select
# under the License.
import gettext
+import six
-gettext.install('neutron', unicode=1)
+if six.PY2:
+ gettext.install('neutron', unicode=1)
+else:
+ gettext.install('neutron')
#
import datetime
-import Queue
+from six.moves import queue as Queue
from oslo_utils import timeutils
import fcntl
import glob
import grp
-import httplib
import os
import pwd
import shlex
from oslo_log import loggers
from oslo_rootwrap import client
from oslo_utils import excutils
+from six.moves import http_client as httplib
from neutron.agent.common import config
from neutron.common import constants
# License for the specific language governing permissions and limitations
# under the License.
-import Queue
+from six.moves import queue as Queue
import time
from oslo_config import cfg
# under the License.
import os
-import Queue
+from six.moves import queue as Queue
import threading
import traceback
# See the License for the specific language governing permissions and
# limitations under the License.
-import ConfigParser
import importlib
import os
from oslo_config import cfg
from oslo_log import log as logging
+from six.moves import configparser as ConfigParser
LOG = logging.getLogger(__name__)
# under the License.
-import httplib
+from six.moves import http_client as httplib
# Topic for info notifications between the plugin and agent
INFO = 'info'
# under the License.
-import httplib
+from six.moves import http_client as httplib
import urllib
import httplib2
"""Library to talk to NVSD controller."""
-import httplib
+from six.moves import http_client as httplib
import time
from oslo_config import cfg
import copy
import hashlib
-import httplib
+from six.moves import http_client as httplib
import json
import posixpath
import re
# License for the specific language governing permissions and limitations
# under the License.
-import ConfigParser
+from six.moves import configparser as ConfigParser
import contextlib
from tempest_lib import exceptions as lib_exc
import types
# License for the specific language governing permissions and limitations
# under the License.
-import httplib
+from six.moves import http_client as httplib
from oslo_config import cfg
from webob import exc
"""Test of Policy Engine For Neutron"""
-import StringIO
-import urllib2
-
import mock
from oslo_config import cfg
from oslo_serialization import jsonutils
self.assertEqual(result, True)
@mock.patch.object(urlrequest, 'urlopen',
- return_value=StringIO.StringIO("True"))
+ return_value=six.StringIO("True"))
def test_enforce_http_true(self, mock_urlrequest):
action = "example:get_http"
target = {}
def fakeurlopen(url, post_data):
return six.StringIO("False")
- with mock.patch.object(urllib2, 'urlopen', new=fakeurlopen):
+ with mock.patch.object(urlrequest, 'urlopen', new=fakeurlopen):
action = "example:get_http"
target = {}
self.assertRaises(common_policy.PolicyNotAuthorized,
import os
import socket
import ssl
-import urllib2
import mock
from oslo_config import cfg
+import six.moves.urllib.request as urlrequest
import testtools
import webob
import webob.exc
# introduced in python 2.7.9 under PEP-0476
# https://github.com/python/peps/blob/master/pep-0476.txt
if hasattr(ssl, "_create_unverified_context"):
- opener = urllib2.build_opener(
- urllib2.ProxyHandler({}),
- urllib2.HTTPSHandler(context=ssl._create_unverified_context())
+ opener = urlrequest.build_opener(
+ urlrequest.ProxyHandler({}),
+ urlrequest.HTTPSHandler(context=ssl._create_unverified_context())
)
else:
- opener = urllib2.build_opener(urllib2.ProxyHandler({}))
+ opener = urlrequest.build_opener(urlrequest.ProxyHandler({}))
return opener.open(*args, **kwargs)
[tox]
-envlist = py27,pep8
+envlist = py27,py34,pep8
minversion = 1.8
skipsdist = True
[testenv:docs]
commands = sphinx-build -W -b html doc/source doc/build
+[testenv:py34]
+commands = python -m testtools.run \
+ neutron.tests.fullstack.test_l3_agent \
+ neutron.tests.unit.common.test_rpc
+
[flake8]
# E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent