summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParide Legovini <paride@ubuntu.com>2022-06-27 16:36:41 +0200
committerGitHub <noreply@github.com>2022-06-27 09:36:41 -0500
commita6624700fc8943197cf9daa53fb6af77a7a5424c (patch)
tree3b1ba16160271d33b7e3a194df7f4b686c07a40d
parentd0f13f456b41fa7679548edef67960dc827b2f65 (diff)
downloadcloud-init-git-a6624700fc8943197cf9daa53fb6af77a7a5424c.tar.gz
CI: add non-blocking run against the linters tip versions (#1531)
Changes: * Tox: the tip-black and tip-isort environments. * Tox: reuse the non-tip commands in the tip- environments. * Add non-blocking (continue-on-error: true) step in the test test matrix to run the tip- linters on ubuntu-latest. * Code fixups to make tip-pylint pass. * Bump the pinned pylint version to 2.13.9 (last version supporting Python 3.6).
-rw-r--r--.github/workflows/check_format.yml13
-rw-r--r--.pylintrc3
-rw-r--r--cloudinit/config/cc_ssh.py2
-rw-r--r--tests/unittests/test_url_helper.py20
-rw-r--r--tox.ini16
5 files changed, 38 insertions, 16 deletions
diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml
index 5c3e7c57..7b52d278 100644
--- a/.github/workflows/check_format.yml
+++ b/.github/workflows/check_format.yml
@@ -15,7 +15,11 @@ jobs:
fail-fast: false
matrix:
env: [flake8, mypy, pylint, black, isort]
- runs-on: ubuntu-18.04
+ lint-with:
+ - {tip-versions: false, os: ubuntu-18.04}
+ - {tip-versions: true, os: ubuntu-latest}
+ name: ${{ matrix.lint-with.tip-versions && 'Check format (tip)' || 'Check format (pinned)' }}
+ runs-on: ${{ matrix.lint-with.os }}
steps:
- name: "Checkout #1"
uses: actions/checkout@v3.0.0
@@ -34,7 +38,14 @@ jobs:
run: python3 --version
- name: Test
+ if: matrix.lint-with.tip-versions
env:
# matrix env: not to be confused w/environment variables or testenv
TOXENV: ${{ matrix.env }}
run: tox
+ - name: Test (tip versions)
+ if: matrix.lint-with.tip-versions
+ continue-on-error: true
+ env:
+ TOXENV: tip-${{ matrix.env }}
+ run: tox
diff --git a/.pylintrc b/.pylintrc
index 3edb0092..ea686815 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -25,8 +25,9 @@ jobs=4
# W0703(broad-except)
# W1401(anomalous-backslash-in-string)
# W1514(unspecified-encoding)
+# E0012(bad-option-value)
-disable=C, F, I, R, W0201, W0212, W0221, W0222, W0223, W0231, W0311, W0511, W0602, W0603, W0611, W0613, W0621, W0622, W0631, W0703, W1401, W1514
+disable=C, F, I, R, W0201, W0212, W0221, W0222, W0223, W0231, W0311, W0511, W0602, W0603, W0611, W0613, W0621, W0622, W0631, W0703, W1401, W1514, E0012
[REPORTS]
diff --git a/cloudinit/config/cc_ssh.py b/cloudinit/config/cc_ssh.py
index 33c1fd0c..9f71f273 100644
--- a/cloudinit/config/cc_ssh.py
+++ b/cloudinit/config/cc_ssh.py
@@ -213,7 +213,7 @@ def handle(_name, cfg, cloud: Cloud, log: Logger, _args):
reason = "unsupported"
else:
reason = "unrecognized"
- log.warning("Skipping %s ssh_keys" ' entry: "%s"', reason, key)
+ log.warning('Skipping %s ssh_keys entry: "%s"', reason, key)
continue
tgt_fn = CONFIG_KEY_TO_FILE[key][0]
tgt_perms = CONFIG_KEY_TO_FILE[key][1]
diff --git a/tests/unittests/test_url_helper.py b/tests/unittests/test_url_helper.py
index a9b9a85f..f756a838 100644
--- a/tests/unittests/test_url_helper.py
+++ b/tests/unittests/test_url_helper.py
@@ -282,7 +282,7 @@ class TestDualStack:
"""
@pytest.mark.parametrize(
- "func," "addresses," "stagger_delay," "timeout," "expected_val,",
+ ["func", "addresses", "stagger_delay", "timeout", "expected_val"],
[
# Assert order based on timeout
(lambda x, _: x, ("one", "two"), 1, 1, "one"),
@@ -346,12 +346,14 @@ class TestDualStack:
event.set()
@pytest.mark.parametrize(
- "func,"
- "addresses,"
- "stagger_delay,"
- "timeout,"
- "message,"
- "expected_exc",
+ [
+ "func",
+ "addresses",
+ "stagger_delay",
+ "timeout",
+ "message",
+ "expected_exc",
+ ],
[
(
lambda _a, _b: 1 / 0,
@@ -370,7 +372,7 @@ class TestDualStack:
ZeroDivisionError,
),
(
- lambda _a, _b: [][0],
+ lambda _a, _b: [][0], # pylint: disable=E0643
("matter", "these"),
0,
1,
@@ -479,7 +481,7 @@ class TestUrlHelper:
return (200, {"request-id": "0"}, cls.success)
@pytest.mark.parametrize(
- "addresses," "expected_address_index," "response,",
+ ["addresses", "expected_address_index", "response"],
[
# Use timeout to test ordering happens as expected
((ADDR1, SLEEP1), 0, "SUCCESS"),
diff --git a/tox.ini b/tox.ini
index 92bba858..43401e8e 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,7 +17,7 @@ black==22.3.0
flake8==4.0.1
isort==5.10.1
mypy==0.950
-pylint==2.13.8
+pylint==2.13.9
pytest==7.0.1
types-jsonschema==4.4.2
types-oauthlib==3.1.6
@@ -163,11 +163,10 @@ commands =
{envpython} -m sphinx {posargs:-b linkcheck doc/rtd doc/rtd_html}
[testenv:tip-flake8]
-commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ conftest.py setup.py}
deps = flake8
+commands = {[testenv:flake8]commands}
[testenv:tip-mypy]
-commands = {envpython} -m mypy --install-types --non-interactive cloudinit/ tests/ tools/
deps =
mypy
pytest
@@ -176,15 +175,24 @@ deps =
types-PyYAML
types-requests
types-setuptools
+commands = {[testenv:mypy]commands}
[testenv:tip-pylint]
-commands = {envpython} -m pylint {posargs:cloudinit/ tests/ tools/ conftest.py setup.py}
deps =
# requirements
pylint
# test-requirements
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
+commands = {[testenv:pylint]commands}
+
+[testenv:tip-black]
+deps = black
+commands = {[testenv:black]commands}
+
+[testenv:tip-isort]
+deps = isort
+commands = {[testenv:isort]commands}
[testenv:integration-tests]
commands = {envpython} -m pytest --log-cli-level=INFO -vv {posargs:tests/integration_tests}