Prep works for Py3 gate

set tox.ini to py34/py35 environment which is a part of unittest which
is runnable with py3 and fix some syntax errors from py3 to run them.

Change-Id: I30744101c3c930e18a58e22a383c47f7ca73c6e8
This commit is contained in:
Kota Tsuyuzaki 2016-09-02 01:37:40 -07:00 committed by Takashi Kajinami
parent 3d3fced238
commit 8505cbeed8
6 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
SRC_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")
SRC_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))")
cd ${SRC_DIR}/tests/unit
nosetests --exe -v $@
rvalue=$?

View File

@ -20,6 +20,7 @@ import stat
import subprocess
import sys
import time
import six
import eventlet
import json
@ -676,9 +677,7 @@ class StorletInvocationProtocol(object):
% self.task_id)
pass
# TODO(takashi): this should be replaced by six.rerase
# when supporting py3
raise exc_type, exc_value, exc_traceback
six.reraise(exc_type, exc_value, exc_traceback)
if fd not in r:
raise StorletRuntimeException('Read fd is not ready')

View File

@ -11,7 +11,7 @@ See the License for the specific language governing permissions and
Limitations under the License.
-------------------------------------------------------------------------"""
import ConfigParser
from six.moves import configparser as ConfigParser
from eventlet import Timeout
from swift.common.swob import HTTPException, HTTPInternalServerError, wsgify
from swift.common.utils import config_true_value, get_logger, \

View File

@ -14,6 +14,7 @@
# limitations under the License.
import unittest
import six
from six import StringIO
from tests.unit.swift import FakeLogger
from storlet_gateway.gateways.docker.gateway import DockerStorletRequest, \
@ -130,6 +131,10 @@ class TestDockerStorletRequest(unittest.TestCase):
class TestStorletDockerGateway(unittest.TestCase):
def setUp(self):
if six.PY3:
self.skipTest(
"swift.common.internal_client.InternalClient for testing"
"doesn't suppoert py3 yet")
# TODO(takashi): take these values from config file
self.tempdir = mkdtemp()
self.sconf = {

View File

@ -26,7 +26,6 @@ from storlet_gateway.gateways.docker.gateway import DockerStorletRequest
from storlet_gateway.gateways.docker.runtime import RunTimeSandbox, \
RunTimePaths, StorletInvocationProtocol
from tests.unit.swift import FakeLogger
from exceptions import AssertionError
from tests.unit import with_tempdir

View File

@ -27,6 +27,14 @@ commands =
flake8
flake8 --filename=* Engine/agent/bin
[testenv:py34]
commands =
nosetests -v \
tests/unit/swift/storlet_gateway
[testenv:py35]
commands = {[testenv:py34]commands}
[testenv:func]
commands = ./.functests jenkins