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
ad1b69074b
14
.zuul.yaml
14
.zuul.yaml
|
@ -10,12 +10,14 @@
|
|||
- stx-distcloud-client-tox-pep8
|
||||
- stx-distcloud-client-tox-py39
|
||||
- stx-distcloud-client-tox-pylint
|
||||
- stx-distcloud-client-tox-black
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-linters
|
||||
- stx-distcloud-client-tox-pep8
|
||||
- stx-distcloud-client-tox-py39
|
||||
- stx-distcloud-client-tox-pylint
|
||||
- stx-distcloud-client-tox-black
|
||||
post:
|
||||
jobs:
|
||||
- stx-distcloud-client-upload-git-mirror
|
||||
|
@ -50,6 +52,18 @@
|
|||
tox_envlist: pep8
|
||||
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: distributedcloud-client/black_pre_run.yaml
|
||||
|
||||
- job:
|
||||
name: stx-distcloud-client-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 sys
|
||||
|
||||
from cliff import app, commandmanager
|
||||
from cliff import app
|
||||
from cliff import commandmanager
|
||||
from cliff import help as cliff_help
|
||||
from osc_lib.command import command
|
||||
|
||||
|
|
|
@ -263,7 +263,8 @@ FAKE_INSTALL_VALUES = {
|
|||
class FakeResponse:
|
||||
"""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.content = content
|
||||
self.headers = {}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
[tox]
|
||||
envlist = py39,pep8,pylint
|
||||
minversion = 2.3
|
||||
minversion = 4.4.0
|
||||
skipsdist = True
|
||||
|
||||
toxworkdir = /tmp/{env:USER}_dc_client_tox
|
||||
|
||||
[dcclient]
|
||||
|
@ -10,17 +9,16 @@ client_base_dir = .
|
|||
|
||||
[testenv]
|
||||
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 =
|
||||
VIRTUAL_ENV={envdir}
|
||||
OS_STDOUT_CAPTURE=1
|
||||
OS_STDERR_CAPTURE=1
|
||||
OS_TEST_TIMEOUT=60
|
||||
|
||||
deps = -r{toxinidir}/test-requirements.txt
|
||||
-r{toxinidir}/requirements.txt
|
||||
deps =
|
||||
-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 =
|
||||
rm
|
||||
|
@ -51,6 +49,23 @@ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
|
|||
commands =
|
||||
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]
|
||||
setenv =
|
||||
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]
|
||||
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]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
commands =
|
||||
|
|
Loading…
Reference in New Issue