WIP Create a zuul for black style
Create a format check Test Plan TODO - SUCCESS on black zuul Closes-bug: ##### Change-Id: I5d7b537e83931304ffd5f67ce51e8ebb44f7e65b Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
This commit is contained in:
parent
8405f3b47c
commit
dcbabdad09
14
.zuul.yaml
14
.zuul.yaml
|
@ -10,12 +10,14 @@
|
||||||
- stx-distcloud-client-tox-pep8
|
- stx-distcloud-client-tox-pep8
|
||||||
- stx-distcloud-client-tox-py39
|
- stx-distcloud-client-tox-py39
|
||||||
- stx-distcloud-client-tox-pylint
|
- stx-distcloud-client-tox-pylint
|
||||||
|
- stx-distcloud-client-tox-black
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-tox-linters
|
- openstack-tox-linters
|
||||||
- stx-distcloud-client-tox-pep8
|
- stx-distcloud-client-tox-pep8
|
||||||
- stx-distcloud-client-tox-py39
|
- stx-distcloud-client-tox-py39
|
||||||
- stx-distcloud-client-tox-pylint
|
- stx-distcloud-client-tox-pylint
|
||||||
|
- stx-distcloud-client-tox-black
|
||||||
post:
|
post:
|
||||||
jobs:
|
jobs:
|
||||||
- stx-distcloud-client-upload-git-mirror
|
- stx-distcloud-client-upload-git-mirror
|
||||||
|
@ -50,6 +52,18 @@
|
||||||
tox_envlist: pep8
|
tox_envlist: pep8
|
||||||
tox_extra_args: -c distributedcloud-client/tox.ini
|
tox_extra_args: -c distributedcloud-client/tox.ini
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: stx-distcloud-client-tox-black
|
||||||
|
parent: tox
|
||||||
|
description: Run black for distcloud-client
|
||||||
|
nodeset: debian-bullseye
|
||||||
|
voting: false
|
||||||
|
vars:
|
||||||
|
python_version: 3.9
|
||||||
|
tox_envlist: black_zuul
|
||||||
|
tox_extra_args: -c distributedcloud-client/tox.ini
|
||||||
|
pre-run: black_pre_run.yaml
|
||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: stx-distcloud-client-upload-git-mirror
|
name: stx-distcloud-client-upload-git-mirror
|
||||||
parent: upload-git-mirror
|
parent: upload-git-mirror
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
- hosts: controller
|
||||||
|
tasks:
|
||||||
|
- name: create modified_files.txt
|
||||||
|
command: git diff HEAD^ --name-only -- '*.py' > modified_files.txt
|
|
@ -23,7 +23,8 @@ import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from cliff import app, commandmanager
|
from cliff import app
|
||||||
|
from cliff import commandmanager
|
||||||
from cliff import help as cliff_help
|
from cliff import help as cliff_help
|
||||||
from osc_lib.command import command
|
from osc_lib.command import command
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,8 @@ FAKE_INSTALL_VALUES = {
|
||||||
class FakeResponse:
|
class FakeResponse:
|
||||||
"""Fake response for testing DC Manager Client."""
|
"""Fake response for testing DC Manager Client."""
|
||||||
|
|
||||||
def __init__(self, status_code, content=None):
|
def __init__(self,
|
||||||
|
status_code, content=None):
|
||||||
self.status_code = status_code
|
self.status_code = status_code
|
||||||
self.content = content
|
self.content = content
|
||||||
self.headers = {}
|
self.headers = {}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py39,pep8,pylint
|
envlist = py39,pep8,pylint
|
||||||
minversion = 2.3
|
minversion = 4.4.0
|
||||||
skipsdist = True
|
skipsdist = True
|
||||||
|
|
||||||
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
||||||
|
|
||||||
[dcclient]
|
[dcclient]
|
||||||
|
@ -10,17 +9,16 @@ client_base_dir = .
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python3.9
|
basepython = python3.9
|
||||||
install_command = pip install \
|
|
||||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt} \
|
|
||||||
{opts} {packages}
|
|
||||||
setenv =
|
setenv =
|
||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
OS_STDOUT_CAPTURE=1
|
OS_STDOUT_CAPTURE=1
|
||||||
OS_STDERR_CAPTURE=1
|
OS_STDERR_CAPTURE=1
|
||||||
OS_TEST_TIMEOUT=60
|
OS_TEST_TIMEOUT=60
|
||||||
|
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps =
|
||||||
-r{toxinidir}/requirements.txt
|
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/starlingx/root/raw/branch/master/build-tools/requirements/debian/upper-constraints.txt}
|
||||||
|
-r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
allowlist_externals =
|
allowlist_externals =
|
||||||
rm
|
rm
|
||||||
|
@ -51,6 +49,23 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
||||||
commands =
|
commands =
|
||||||
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
|
pylint {posargs} dcmanagerclient --rcfile=./.pylintrc
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
# To check only the files that will be modified, use the following command:
|
||||||
|
# tox -e black -- --diff --check
|
||||||
|
deps =
|
||||||
|
black>=23.11.0 # MIT
|
||||||
|
commands =
|
||||||
|
black --line-length 85 {posargs} .
|
||||||
|
|
||||||
|
[testenv:black_zuul]
|
||||||
|
setenv =
|
||||||
|
{[testenv]setenv}
|
||||||
|
MODIFIED_FILES={toxinidir}/modified_files.txt
|
||||||
|
deps =
|
||||||
|
black>=23.11.0 # MIT
|
||||||
|
commands =
|
||||||
|
black --line-length 85 --diff --check {env:MODIFIED_FILES}
|
||||||
|
|
||||||
[testenv:cover]
|
[testenv:cover]
|
||||||
setenv =
|
setenv =
|
||||||
PYTHON=coverage run --parallel-mode
|
PYTHON=coverage run --parallel-mode
|
||||||
|
|
6
tox.ini
6
tox.ini
|
@ -27,6 +27,12 @@ description = Dummy environment to allow pep8 to be run in subdir tox
|
||||||
[testenv:pylint]
|
[testenv:pylint]
|
||||||
description = Dummy environment to allow pylint to be run in subdir tox
|
description = Dummy environment to allow pylint to be run in subdir tox
|
||||||
|
|
||||||
|
[testenv:black]
|
||||||
|
description = Dummy environment to allow black to be run in subdir tox
|
||||||
|
|
||||||
|
[testenv:black_zuul]
|
||||||
|
description = Dummy environment to allow black_zuul check to be run in subdir tox
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
deps = -r{toxinidir}/doc/requirements.txt
|
deps = -r{toxinidir}/doc/requirements.txt
|
||||||
commands =
|
commands =
|
||||||
|
|
Loading…
Reference in New Issue