aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2019-07-26 12:58:04 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2019-07-26 16:03:59 +0200
commit7b24ea8dfe1667fe00b87cac9f0a0ca670b6a86f (patch)
tree026ee9db8c5b5b1385439317a03e461570a85af8
parent5dd0d0ffd46e7665fddde8fd2f4da1a9b58506bb (diff)
Switch to Python 3.7 and Alpine 3.10
It also allows building docs as doc8 is broken due to latest OpenStack's upper-constraints. pylint is updated to 2.3.1 (lastest py3.7 version) It disables perm as umask is currently false on lf-virtual1. Change-Id: I8568eeafa44c5dba72e206c532c1f50e3ad547f2 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
-rw-r--r--.travis.yml6
-rw-r--r--build.sh4
-rw-r--r--docker/Dockerfile2
-rw-r--r--test-requirements.txt2
-rw-r--r--tox.ini20
-rw-r--r--upper-constraints.txt2
-rw-r--r--xtesting/ci/run_tests.py5
-rw-r--r--xtesting/ci/tier_builder.py2
-rw-r--r--xtesting/ci/tier_handler.py4
-rw-r--r--xtesting/core/testcase.py2
-rw-r--r--xtesting/tests/unit/core/test_behaveframework.py7
-rw-r--r--xtesting/tests/unit/core/test_feature.py1
-rw-r--r--xtesting/tests/unit/core/test_testcase.py1
13 files changed, 30 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml
index bfc81b26..e9015ff7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,9 +5,9 @@ language: generic
before_script:
- sudo apt-get -y install qemu-user-static
- - sudo add-apt-repository -y ppa:jonathonf/python-3.6
+ - sudo add-apt-repository -y ppa:deadsnakes/ppa
- sudo apt-get update
- - sudo apt-get install python3.6 python3.6-dev
+ - sudo apt-get install python3.7 python3.7-dev
- sudo pip install tox
- sudo -E docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}"
- (cd .. && git clone https://github.com/estesp/manifest-tool)
@@ -18,7 +18,7 @@ jobs:
include:
- stage: run unit tests
script: >
- tox -e docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,py36,cover
+ tox -e docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,py37,cover
- stage: build xtesting images
script: sudo -E bash build.sh
env:
diff --git a/build.sh b/build.sh
index 92e475c4..3b4c8b5d 100644
--- a/build.sh
+++ b/build.sh
@@ -19,10 +19,10 @@ build_opts=(--pull=true --no-cache --force-rm=true)
for arch in ${arch};do
if [[ ${arch} == arm64 ]]; then
find . -name Dockerfile -exec sed -i \
- -e "s|alpine:3.9|multiarch/alpine:arm64-v3.9|g" {} +
+ -e "s|alpine:3.10|multiarch/alpine:arm64-v3.10|g" {} +
elif [[ ${arch} == arm ]]; then
find . -name Dockerfile -exec sed -i \
- -e "s|alpine:3.9|multiarch/alpine:armhf-v3.9|g" {} +
+ -e "s|alpine:3.10|multiarch/alpine:armhf-v3.10|g" {} +
fi
(cd docker && docker build "${build_opts[@]}" \
-t "${repo}/${image}:${arch}-${tag}" .)
diff --git a/docker/Dockerfile b/docker/Dockerfile
index e6d9537b..44ccf72d 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM alpine:3.9
+FROM alpine:3.10
ARG BRANCH=master
ARG OPENSTACK_TAG=master
diff --git a/test-requirements.txt b/test-requirements.txt
index 08f08077..ef2ef201 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -5,7 +5,7 @@ coverage!=4.4 # Apache-2.0
mock # BSD
nose # LGPL
flake8<2.6.0,>=2.5.4 # MIT
-pylint==1.4.5 # GPLv2
+pylint # GPLv2
sphinx!=1.6.6,!=1.6.7,<2.0.0;python_version=='2.7' # BSD
sphinx!=1.6.6,!=1.6.7;python_version>='3.4' # BSD
sphinx-rtd-theme
diff --git a/tox.ini b/tox.ini
index 6dcf9fc4..1904b6e4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,perm,cover
+envlist = docs,pep8,pylint,yamllint,ansiblelint,bashate,py27,py37,cover
skipsdist = True
[testenv]
@@ -19,24 +19,24 @@ commands = nosetests --with-xunit \
xtesting/tests/unit
[testenv:docs]
-basepython = python2.7
+basepython = python3.7
commands =
doc8 README.rst api --ignore-path api/build
sphinx-build -W -b html api/ api/build
[testenv:pep8]
-basepython = python2.7
+basepython = python3.7
commands = flake8
[testenv:pylint]
-basepython = python2.7
+basepython = python3.7
whitelist_externals = bash
commands =
pylint --min-similarity-lines=10 \
--disable=locally-disabled --ignore-imports=y --reports=n xtesting
[testenv:yamllint]
-basepython = python2.7
+basepython = python3.7
files =
.travis.yml
ansible
@@ -45,7 +45,7 @@ commands =
yamllint -s {[testenv:yamllint]files}
[testenv:ansiblelint]
-basepython = python2.7
+basepython = python3.7
commands =
ansible-lint ansible/site.yml
@@ -53,17 +53,17 @@ commands =
commands = nosetests xtesting/tests/unit
[testenv:bashate]
-basepython = python2.7
+basepython = python3.7
files =
build.sh
commands = bashate {[testenv:bashate]files}
[testenv:bandit]
-basepython = python2.7
+basepython = python3.7
commands = bandit -r xtesting -x tests -n 5 -ll -s B602
[testenv:cover]
-basepython = python2.7
+basepython = python3.7
dirs =
xtesting/tests/unit/ci
xtesting/tests/unit/core
@@ -75,7 +75,7 @@ commands = nosetests --with-coverage --cover-tests \
--cover-min-percentage 100 {[testenv:cover]dirs}
[testenv:perm]
-basepython = python2.7
+basepython = python3.7
whitelist_externals = bash
path=. -not -path './.tox/*' -not -path './.git/*' -not -path './doc/reveal.js/*'
commands =
diff --git a/upper-constraints.txt b/upper-constraints.txt
index 920bb47f..bcf55ebd 100644
--- a/upper-constraints.txt
+++ b/upper-constraints.txt
@@ -1,3 +1,5 @@
robotframework===3.1.1
bandit===1.1.0
behave===1.2.6
+pylint===1.9.5;python_version=='2.7'
+pylint===2.3.1;python_version=='3.7'
diff --git a/xtesting/ci/run_tests.py b/xtesting/ci/run_tests.py
index 94bf2787..5e2b49e5 100644
--- a/xtesting/ci/run_tests.py
+++ b/xtesting/ci/run_tests.py
@@ -46,10 +46,9 @@ class Result(enum.Enum):
class BlockingTestFailed(Exception):
"""Exception when the blocking test fails"""
- pass
-class RunTestsParser(object):
+class RunTestsParser():
"""Parser to run tests"""
# pylint: disable=too-few-public-methods
@@ -78,7 +77,7 @@ class RunTestsParser(object):
return vars(self.parser.parse_args(argv))
-class Runner(object):
+class Runner():
"""Runner class"""
def __init__(self):
diff --git a/xtesting/ci/tier_builder.py b/xtesting/ci/tier_builder.py
index b0050b13..27afc7d1 100644
--- a/xtesting/ci/tier_builder.py
+++ b/xtesting/ci/tier_builder.py
@@ -16,7 +16,7 @@ from xtesting.ci import tier_handler
from xtesting.utils import env
-class TierBuilder(object):
+class TierBuilder():
# pylint: disable=missing-docstring
def __init__(self, testcases_file):
diff --git a/xtesting/ci/tier_handler.py b/xtesting/ci/tier_handler.py
index 4b74e37c..8359d91c 100644
--- a/xtesting/ci/tier_handler.py
+++ b/xtesting/ci/tier_handler.py
@@ -34,7 +34,7 @@ def split_text(text, max_len):
return lines
-class Tier(object):
+class Tier():
def __init__(self, name, order, description=""):
self.tests_array = []
@@ -96,7 +96,7 @@ class Tier(object):
return msg.get_string()
-class TestCase(object):
+class TestCase():
def __init__(self, name, enabled, skipped, criteria, blocking,
description="", project=""):
diff --git a/xtesting/core/testcase.py b/xtesting/core/testcase.py
index c548a2a8..c89e4c88 100644
--- a/xtesting/core/testcase.py
+++ b/xtesting/core/testcase.py
@@ -27,7 +27,7 @@ __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
@six.add_metaclass(abc.ABCMeta)
-class TestCase(object):
+class TestCase():
# pylint: disable=too-many-instance-attributes
"""Base model for single test case."""
diff --git a/xtesting/tests/unit/core/test_behaveframework.py b/xtesting/tests/unit/core/test_behaveframework.py
index f18cac03..70ca9738 100644
--- a/xtesting/tests/unit/core/test_behaveframework.py
+++ b/xtesting/tests/unit/core/test_behaveframework.py
@@ -66,11 +66,10 @@ class ParseResultTesting(unittest.TestCase):
data = [{'status': 'passed'}, {'status': 'passed'}]
self._test_result(data, 100)
- def test_count(self):
+ @mock.patch('six.moves.builtins.open', mock.mock_open())
+ def test_count(self, *args): # pylint: disable=unused-argument
self._response.extend([{'status': 'failed'}, {'status': 'skipped'}])
- with mock.patch('six.moves.builtins.open', mock.mock_open()), \
- mock.patch('json.load', mock.Mock(
- return_value=self._response)):
+ with mock.patch('json.load', mock.Mock(return_value=self._response)):
self.test.parse_results()
self.assertEqual(self.test.details['pass_tests'], 1)
self.assertEqual(self.test.details['fail_tests'], 1)
diff --git a/xtesting/tests/unit/core/test_feature.py b/xtesting/tests/unit/core/test_feature.py
index 30678798..785f6e16 100644
--- a/xtesting/tests/unit/core/test_feature.py
+++ b/xtesting/tests/unit/core/test_feature.py
@@ -29,6 +29,7 @@ class FakeTestCase(feature.Feature):
class AbstractFeatureTesting(unittest.TestCase):
def test_run_unimplemented(self):
+ # pylint: disable=abstract-class-instantiated
with self.assertRaises(TypeError):
feature.Feature(case_name="feature", project_name="xtesting")
diff --git a/xtesting/tests/unit/core/test_testcase.py b/xtesting/tests/unit/core/test_testcase.py
index 51ea6f35..fc612973 100644
--- a/xtesting/tests/unit/core/test_testcase.py
+++ b/xtesting/tests/unit/core/test_testcase.py
@@ -35,6 +35,7 @@ class FakeTestCase(testcase.TestCase):
class AbstractTestCaseTesting(unittest.TestCase):
def test_run_unimplemented(self):
+ # pylint: disable=abstract-class-instantiated
with self.assertRaises(TypeError):
testcase.TestCase(case_name="base", project_name="xtesting")