Add test framework for patch alarm manager
This update sets up the initial testing framework for the patch-alarm module, with a basic test case. Additionally, this restructures the tox.ini files. Now that each python module has its own tox.ini and tests, the top-level tox.ini can recursively use those. As well, the Zuul setup can now split the jobs for each module. Change-Id: I79eed868c5b42e2545ccf0c11dbbbea4336b9b19 Story: 2005939 Task: 34783 Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
parent
f27f1c1539
commit
a5e51f98c8
106
.zuul.yaml
106
.zuul.yaml
@ -8,30 +8,60 @@
|
||||
- build-openstack-releasenotes
|
||||
- flock-devstack-update
|
||||
- openstack-tox-linters
|
||||
- openstack-tox-pep8
|
||||
- tsconfig-tox-flake8
|
||||
- tsconfig-tox-pylint
|
||||
- tsconfig-tox-py27
|
||||
- tsconfig-tox-py36
|
||||
- patch-tox-flake8
|
||||
- patch-tox-pylint
|
||||
- patch-tox-py27
|
||||
- patch-tox-py36
|
||||
- stx-updates-pylint
|
||||
- patch-alarm-tox-flake8
|
||||
- patch-alarm-tox-pylint
|
||||
- patch-alarm-tox-py27
|
||||
- patch-alarm-tox-py36
|
||||
gate:
|
||||
jobs:
|
||||
- build-openstack-api-ref
|
||||
- build-openstack-releasenotes
|
||||
- flock-devstack-update
|
||||
- openstack-tox-linters
|
||||
- openstack-tox-pep8
|
||||
- tsconfig-tox-flake8
|
||||
- tsconfig-tox-pylint
|
||||
- tsconfig-tox-py27
|
||||
- tsconfig-tox-py36
|
||||
- patch-tox-flake8
|
||||
- patch-tox-pylint
|
||||
- patch-tox-py27
|
||||
- patch-tox-py36
|
||||
- stx-updates-pylint
|
||||
- patch-alarm-tox-flake8
|
||||
- patch-alarm-tox-pylint
|
||||
- patch-alarm-tox-py27
|
||||
- patch-alarm-tox-py36
|
||||
post:
|
||||
jobs:
|
||||
- publish-stx-api-ref
|
||||
- publish-stx-tox
|
||||
- publish-stx-releasenotes
|
||||
|
||||
- job:
|
||||
name: tsconfig-tox-flake8
|
||||
parent: tox
|
||||
files:
|
||||
- tsconfig/tsconfig/*
|
||||
vars:
|
||||
tox_envlist: flake8
|
||||
tox_extra_args: -c tsconfig/tsconfig/tox.ini
|
||||
|
||||
- job:
|
||||
name: tsconfig-tox-pylint
|
||||
parent: tox
|
||||
files:
|
||||
- tsconfig/tsconfig/*
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
tox_extra_args: -c tsconfig/tsconfig/tox.ini
|
||||
|
||||
- job:
|
||||
name: tsconfig-tox-py27
|
||||
parent: tox
|
||||
@ -50,6 +80,28 @@
|
||||
tox_envlist: py36
|
||||
tox_extra_args: -c tsconfig/tsconfig/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-tox-flake8
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
files:
|
||||
- cgcs-patch/cgcs-patch/*
|
||||
vars:
|
||||
tox_envlist: flake8
|
||||
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-tox-pylint
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
files:
|
||||
- cgcs-patch/cgcs-patch/*
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-tox-py27
|
||||
parent: tox
|
||||
@ -73,12 +125,52 @@
|
||||
tox_extra_args: -c cgcs-patch/cgcs-patch/tox.ini
|
||||
|
||||
- job:
|
||||
name: stx-updates-pylint
|
||||
parent: openstack-tox-pylint
|
||||
name: patch-alarm-tox-flake8
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
- starlingx/integ
|
||||
files:
|
||||
- patch-alarm/patch-alarm/*
|
||||
vars:
|
||||
tox_envlist: flake8
|
||||
tox_extra_args: -c patch-alarm/patch-alarm/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-alarm-tox-pylint
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
files:
|
||||
- patch-alarm/patch-alarm/*
|
||||
vars:
|
||||
tox_envlist: pylint
|
||||
tox_extra_args: -c patch-alarm/patch-alarm/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-alarm-tox-py27
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
files:
|
||||
- patch-alarm/patch-alarm/*
|
||||
vars:
|
||||
tox_envlist: py27
|
||||
tox_extra_args: -c patch-alarm/patch-alarm/tox.ini
|
||||
|
||||
- job:
|
||||
name: patch-alarm-tox-py36
|
||||
parent: tox
|
||||
required-projects:
|
||||
- starlingx/config
|
||||
- starlingx/fault
|
||||
files:
|
||||
- patch-alarm/patch-alarm/*
|
||||
vars:
|
||||
tox_envlist: py36
|
||||
tox_extra_args: -c patch-alarm/patch-alarm/tox.ini
|
||||
|
||||
- job:
|
||||
name: flock-devstack-update
|
||||
|
@ -57,7 +57,7 @@ def verify_hash(data_hash, signature_bytes, certificate_list):
|
||||
# OpenSSL
|
||||
verifier = PKCS1_PSS.new(pub_key)
|
||||
try:
|
||||
verified = verifier.verify(data_hash, signature_bytes)
|
||||
verified = verifier.verify(data_hash, signature_bytes) # pylint: disable=not-callable
|
||||
except ValueError as e:
|
||||
verified = False
|
||||
|
||||
|
@ -11,7 +11,7 @@ import testtools
|
||||
|
||||
sys.modules['rpm'] = mock.Mock()
|
||||
|
||||
import cgcs_patch.patch_functions
|
||||
import cgcs_patch.patch_functions # noqa: E402
|
||||
|
||||
|
||||
class CgcsPatchTestCase(testtools.TestCase):
|
||||
|
@ -13,7 +13,7 @@ sys.modules['rpm'] = mock.Mock()
|
||||
sys.modules['rpmUtils'] = mock.Mock()
|
||||
sys.modules['rpmUtils.miscutils'] = mock.Mock()
|
||||
|
||||
import cgcs_patch.patch_agent
|
||||
import cgcs_patch.patch_agent # noqa: E402
|
||||
|
||||
|
||||
class CgcsPatchAgentTestCase(testtools.TestCase):
|
||||
|
@ -13,7 +13,7 @@ sys.modules['rpm'] = mock.Mock()
|
||||
sys.modules['rpmUtils'] = mock.Mock()
|
||||
sys.modules['rpmUtils.miscutils'] = mock.Mock()
|
||||
|
||||
import cgcs_patch.patch_controller
|
||||
import cgcs_patch.patch_controller # noqa: E402
|
||||
|
||||
|
||||
class CgcsPatchControllerTestCase(testtools.TestCase):
|
||||
|
337
cgcs-patch/cgcs-patch/pylint.rc
Normal file
337
cgcs-patch/cgcs-patch/pylint.rc
Normal file
@ -0,0 +1,337 @@
|
||||
[MASTER]
|
||||
|
||||
# Specify a configuration file.
|
||||
#rcfile=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Profiled execution.
|
||||
profile=no
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# DEPRECATED
|
||||
include-ids=no
|
||||
|
||||
# DEPRECATED
|
||||
symbols=no
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time. See also the "--disable" option for examples.
|
||||
#enable=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once).You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
#disable=
|
||||
disable=C, R, W0603, W0612, W0613, W0702, W0703, W1201
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html. You can also give a reporter class, eg
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]".
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=yes
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Add a comment according to your evaluation note. This is used by the global
|
||||
# evaluation report (RP0004).
|
||||
comment=no
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
#msg-template=
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Required attributes for module, separated by a comma
|
||||
required-attributes=
|
||||
|
||||
# List of builtins function names that should not be used, separated by a comma
|
||||
bad-functions=map,filter,apply,input,file
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=i,j,k,ex,Run,_
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for function names
|
||||
function-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for variable names
|
||||
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Naming hint for constant names
|
||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for attribute names
|
||||
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for argument names
|
||||
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Naming hint for class attribute names
|
||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Naming hint for inline iteration names
|
||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Naming hint for class names
|
||||
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Naming hint for module names
|
||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for method names
|
||||
method-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=__.*__
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=80
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled
|
||||
no-space-check=trailing-comma,dict-separator
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis
|
||||
ignored-modules=
|
||||
|
||||
# List of classes names for which member attributes should not be checked
|
||||
# (useful for classes with attributes dynamically set).
|
||||
ignored-classes=rpm,PKCS1_PSS
|
||||
|
||||
# When zope mode is activated, add a predefined set of Zope acquired attributes
|
||||
# to generated-members.
|
||||
zope=no
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E0201 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=REQUEST,acl_users,aq_parent
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||
# not used).
|
||||
dummy-variables-rgx=_$|dummy
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of interface methods to ignore, separated by a comma. This is used for
|
||||
# instance to not check methods defines in Zope's Interface base class.
|
||||
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*
|
||||
|
||||
# Maximum number of locals for function / method body
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of return / yield for function / method body
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=regsub,TERMIOS,Bastion,rexec
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
@ -6,3 +6,4 @@ keystonemiddleware
|
||||
oslo_config
|
||||
pecan
|
||||
pycryptodome;python_version=='2.7'
|
||||
requests_toolbelt
|
||||
|
@ -1,6 +1,13 @@
|
||||
#
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[tox]
|
||||
envlist = py27,py36,cover
|
||||
envlist = flake8,py27,py36,pylint,cover
|
||||
minversion = 2.3.2
|
||||
skipsdist = True
|
||||
|
||||
stxdir = {toxinidir}/../../..
|
||||
|
||||
@ -28,27 +35,62 @@ deps = -r{toxinidir}/requirements.txt
|
||||
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
||||
-e{[tox]stxdir}/update/tsconfig/tsconfig
|
||||
|
||||
whitelist_externals = find
|
||||
sh
|
||||
|
||||
[testenv:stestr]
|
||||
commands =
|
||||
find . -name "*.pyc" -delete
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
|
||||
whitelist_externals = find
|
||||
sh
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[testenv:py36]
|
||||
basepython = python3.6
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[flake8]
|
||||
# ignore below errors , will fix flake8 errors in future
|
||||
# H101 Use TODO(NAME)
|
||||
# H102 Apache 2.0 license header not found
|
||||
# H105 Don't use author tags
|
||||
# H306 imports not in alphabetical order
|
||||
# H401 docstring should not start with a space
|
||||
# H404 multi line docstring should start without a leading new line
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# E501 line too long. skipped because some of the code files include templates
|
||||
# that end up quite wide
|
||||
# F401 'XXXXX' imported but unused
|
||||
# F841 local variable 'XXXXXX' is assigned to but never used
|
||||
show-source = True
|
||||
#ignore = H101,H102,H105,H306,H401,H404,H405,E501,F401,F841
|
||||
ignore = H101,H102,H105,H306,H401,H404,H405,E501,F401,F841
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||
# H106: Don't put vim configuration in source files (off by default).
|
||||
# H203: Use assertIs(Not)None to check for None (off by default).
|
||||
# enable: H904 Delay string interpolations at logging calls (off by default).
|
||||
enable-extensions = H106 H203 H904
|
||||
max-line-length = 120
|
||||
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
usedevelop = False
|
||||
#skip_install = True
|
||||
commands =
|
||||
{[testenv]commands}
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
flake8 {posargs} .
|
||||
|
||||
[testenv:pylint]
|
||||
deps = {[testenv]deps}
|
||||
pylint
|
||||
|
||||
basepython = python2.7
|
||||
sitepackages = False
|
||||
|
||||
commands = pylint cgcs_patch --rcfile=./pylint.rc
|
||||
|
||||
[testenv:cover]
|
||||
setenv =
|
||||
|
7
patch-alarm/patch-alarm/.coveragerc
Normal file
7
patch-alarm/patch-alarm/.coveragerc
Normal file
@ -0,0 +1,7 @@
|
||||
[run]
|
||||
branch = True
|
||||
source = patch_alarm
|
||||
omit = patch_alarm/tests/*
|
||||
|
||||
[report]
|
||||
ignore_errors = True
|
2
patch-alarm/patch-alarm/.stestr.conf
Normal file
2
patch-alarm/patch-alarm/.stestr.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[DEFAULT]
|
||||
test_path=patch_alarm/tests
|
@ -160,7 +160,7 @@ class PatchAlarmDaemon(object):
|
||||
severity=fm_constants.FM_ALARM_SEVERITY_CRITICAL,
|
||||
reason_text='Developer patch certificate is enabled',
|
||||
probable_cause=fm_constants.ALARM_PROBABLE_CAUSE_65,
|
||||
proposed_repair_action='Reinstall system to disable certificate and remove untrusted patches',
|
||||
proposed_repair_action='Reinstall system to disable certificate and remove untrusted patches', # noqa: E501
|
||||
suppression=False,
|
||||
service_affecting=False)
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
|
||||
import mock
|
||||
import sys
|
||||
import testtools
|
||||
|
||||
sys.modules['daemon'] = mock.Mock()
|
||||
sys.modules['daemon.runner'] = mock.Mock()
|
||||
sys.modules['fm_core'] = mock.Mock()
|
||||
|
||||
import patch_alarm.patch_alarm_manager # noqa: E402
|
||||
|
||||
|
||||
class PatchAlarmTestCase(testtools.TestCase):
|
||||
|
||||
def test_patch_alarm_instantiate(self):
|
||||
patch_alarm.patch_alarm_manager.PatchAlarmDaemon()
|
337
patch-alarm/patch-alarm/pylint.rc
Normal file
337
patch-alarm/patch-alarm/pylint.rc
Normal file
@ -0,0 +1,337 @@
|
||||
[MASTER]
|
||||
|
||||
# Specify a configuration file.
|
||||
#rcfile=
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as
|
||||
# pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Profiled execution.
|
||||
profile=no
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not
|
||||
# paths.
|
||||
ignore=CVS
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
# DEPRECATED
|
||||
include-ids=no
|
||||
|
||||
# DEPRECATED
|
||||
symbols=no
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time. See also the "--disable" option for examples.
|
||||
#enable=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifiers separated by comma (,) or put this
|
||||
# option multiple times (only on the command line, not in the configuration
|
||||
# file where it should appear only once).You can also use "--disable=all" to
|
||||
# disable everything first and then reenable specific checks. For example, if
|
||||
# you want to run only the similarities checker, you can use "--disable=all
|
||||
# --enable=similarities". If you want to run only the classes checker, but have
|
||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||
# --disable=W"
|
||||
#disable=
|
||||
disable=C, R, W0603, W0612, W0613, W0702, W0703, W1201
|
||||
|
||||
|
||||
[REPORTS]
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html. You can also give a reporter class, eg
|
||||
# mypackage.mymodule.MyReporterClass.
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]".
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=yes
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
# Add a comment according to your evaluation note. This is used by the global
|
||||
# evaluation report (RP0004).
|
||||
comment=no
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
#msg-template=
|
||||
|
||||
|
||||
[BASIC]
|
||||
|
||||
# Required attributes for module, separated by a comma
|
||||
required-attributes=
|
||||
|
||||
# List of builtins function names that should not be used, separated by a comma
|
||||
bad-functions=map,filter,apply,input,file
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=i,j,k,ex,Run,_
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Colon-delimited sets of names that determine each other's naming style when
|
||||
# the name regexes allow several styles.
|
||||
name-group=
|
||||
|
||||
# Include a hint for the correct naming format with invalid-name
|
||||
include-naming-hint=no
|
||||
|
||||
# Regular expression matching correct function names
|
||||
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for function names
|
||||
function-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct variable names
|
||||
variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for variable names
|
||||
variable-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct constant names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Naming hint for constant names
|
||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression matching correct attribute names
|
||||
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for attribute names
|
||||
attr-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct argument names
|
||||
argument-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for argument names
|
||||
argument-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression matching correct class attribute names
|
||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Naming hint for class attribute names
|
||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||
|
||||
# Regular expression matching correct inline iteration names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Naming hint for inline iteration names
|
||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Regular expression matching correct class names
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Naming hint for class names
|
||||
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression matching correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Naming hint for module names
|
||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression matching correct method names
|
||||
method-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Naming hint for method names
|
||||
method-name-hint=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match function or class names that do
|
||||
# not require a docstring.
|
||||
no-docstring-rgx=__.*__
|
||||
|
||||
# Minimum line length for functions/classes that require docstrings, shorter
|
||||
# ones are exempt.
|
||||
docstring-min-length=-1
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=80
|
||||
|
||||
# Regexp for a line that is allowed to be longer than the limit.
|
||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
||||
|
||||
# Allow the body of an if to be on the same line as the test if there is no
|
||||
# else.
|
||||
single-line-if-stmt=no
|
||||
|
||||
# List of optional constructs for which whitespace checking is disabled
|
||||
no-space-check=trailing-comma,dict-separator
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
||||
# tab).
|
||||
indent-string=' '
|
||||
|
||||
# Number of spaces of indent required inside a hanging or continued line.
|
||||
indent-after-paren=4
|
||||
|
||||
|
||||
[LOGGING]
|
||||
|
||||
# Logging modules to check that the string format arguments are in logging
|
||||
# function parameter format
|
||||
logging-modules=logging
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
# Ignore imports when computing similarities.
|
||||
ignore-imports=no
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of module names for which member attributes should not be checked
|
||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
||||
# and thus existing member attributes cannot be deduced by static analysis
|
||||
ignored-modules=
|
||||
|
||||
# List of classes names for which member attributes should not be checked
|
||||
# (useful for classes with attributes dynamically set).
|
||||
ignored-classes=rpm,PKCS1_PSS
|
||||
|
||||
# When zope mode is activated, add a predefined set of Zope acquired attributes
|
||||
# to generated-members.
|
||||
zope=no
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E0201 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=REQUEST,acl_users,aq_parent
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# A regular expression matching the name of dummy variables (i.e. expectedly
|
||||
# not used).
|
||||
dummy-variables-rgx=_$|dummy
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
|
||||
[CLASSES]
|
||||
|
||||
# List of interface methods to ignore, separated by a comma. This is used for
|
||||
# instance to not check methods defines in Zope's Interface base class.
|
||||
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
|
||||
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
# List of valid names for the first argument in a metaclass class method.
|
||||
valid-metaclass-classmethod-first-arg=mcs
|
||||
|
||||
|
||||
[DESIGN]
|
||||
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*
|
||||
|
||||
# Maximum number of locals for function / method body
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of return / yield for function / method body
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=regsub,TERMIOS,Bastion,rexec
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
5
patch-alarm/patch-alarm/requirements.txt
Normal file
5
patch-alarm/patch-alarm/requirements.txt
Normal file
@ -0,0 +1,5 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
python-daemon
|
22
patch-alarm/patch-alarm/setup.cfg
Normal file
22
patch-alarm/patch-alarm/setup.cfg
Normal file
@ -0,0 +1,22 @@
|
||||
[metadata]
|
||||
license_files = LICENSE
|
||||
name = patch_alarm
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
|
||||
[files]
|
||||
packages =
|
||||
patch_alarm
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Copyright (c) 2014 Wind River Systems, Inc.
|
||||
Copyright (c) 2014-2019 Wind River Systems, Inc.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
@ -12,7 +12,7 @@ import setuptools
|
||||
setuptools.setup(
|
||||
name='patch_alarm',
|
||||
version='1.0.0',
|
||||
description='CEPH alarm',
|
||||
description='patch alarm manager',
|
||||
license='Apache-2.0',
|
||||
packages=['patch_alarm'],
|
||||
entry_points={}
|
||||
|
11
patch-alarm/patch-alarm/test-requirements.txt
Normal file
11
patch-alarm/patch-alarm/test-requirements.txt
Normal file
@ -0,0 +1,11 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking>=1.1.0 # Apache-2.0
|
||||
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
mock>=2.0.0 # BSD
|
||||
stestr>=1.0.0 # Apache-2.0
|
||||
testtools>=2.2.0 # MIT
|
||||
|
101
patch-alarm/patch-alarm/tox.ini
Normal file
101
patch-alarm/patch-alarm/tox.ini
Normal file
@ -0,0 +1,101 @@
|
||||
#
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[tox]
|
||||
envlist = flake8,py27,py36,pylint,cover
|
||||
minversion = 2.3.2
|
||||
skipsdist = True
|
||||
|
||||
stxdir = {toxinidir}/../../..
|
||||
|
||||
[testenv]
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
LANG=en_US.UTF-8
|
||||
LANGUAGE=en_US:en
|
||||
LC_ALL=C
|
||||
OS_STDERR_CAPTURE=1
|
||||
OS_STDOUT_CAPTURE=1
|
||||
OS_TEST_PATH=./patch_alarm/tests
|
||||
OS_TEST_TIMEOUT=60
|
||||
PYTHONDONTWRITEBYTECODE=1
|
||||
PYTHONHASHSEED=0
|
||||
PYTHONWARNINGS=default::DeprecationWarning
|
||||
|
||||
sitepackages = True
|
||||
install_command = pip install \
|
||||
-v -v -v \
|
||||
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
|
||||
{opts} {packages}
|
||||
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
-e{[tox]stxdir}/config/sysinv/sysinv/sysinv
|
||||
-e{[tox]stxdir}/fault/fm-api
|
||||
-e{[tox]stxdir}/update/tsconfig/tsconfig
|
||||
-e{[tox]stxdir}/update/cgcs-patch/cgcs-patch
|
||||
|
||||
whitelist_externals = find
|
||||
sh
|
||||
|
||||
[testenv:stestr]
|
||||
commands =
|
||||
find . -name "*.pyc" -delete
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[testenv:py36]
|
||||
basepython = python3.6
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[flake8]
|
||||
# ignore below errors , will fix flake8 errors in future
|
||||
# H102 Apache 2.0 license header not found
|
||||
# H306 imports not in alphabetical order
|
||||
# H401 docstring should not start with a space
|
||||
# H404 multi line docstring should start without a leading new line
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
show-source = True
|
||||
ignore = H102,H306,H401,H404,H405
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||
# H106: Don't put vim configuration in source files (off by default).
|
||||
# H203: Use assertIs(Not)None to check for None (off by default).
|
||||
# enable: H904 Delay string interpolations at logging calls (off by default).
|
||||
enable-extensions = H106 H203 H904
|
||||
max-line-length = 120
|
||||
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python3
|
||||
usedevelop = False
|
||||
#skip_install = True
|
||||
commands =
|
||||
flake8 {posargs} .
|
||||
|
||||
[testenv:pylint]
|
||||
deps = {[testenv]deps}
|
||||
pylint
|
||||
|
||||
basepython = python2.7
|
||||
sitepackages = False
|
||||
|
||||
commands = pylint patch_alarm --rcfile=./pylint.rc
|
||||
|
||||
[testenv:cover]
|
||||
setenv =
|
||||
PYTHON=coverage run --parallel-mode
|
||||
PYTHONDONTWRITEBYTECODE=True
|
||||
|
||||
commands = coverage erase
|
||||
find . -name "*.pyc" -delete
|
||||
stestr run {posargs}
|
||||
coverage combine
|
||||
coverage html -d cover
|
||||
coverage xml -o cover/coverage.xml
|
||||
coverage report
|
@ -186,7 +186,7 @@ max-locals=15
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branchs=12
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
82
tox.ini
82
tox.ini
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2018 Wind River Systems, Inc.
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@ -9,7 +9,7 @@
|
||||
# test suite on all supported python versions. To use it, "pip install tox"
|
||||
# and then run "tox" from this directory.
|
||||
[tox]
|
||||
envlist = linters,pep8,py27,py36,pylint
|
||||
envlist = linters,flake8,py27,py36,pylint,cover
|
||||
minversion = 2.3
|
||||
skipsdist = True
|
||||
|
||||
@ -54,35 +54,15 @@ commands =
|
||||
-print0 | xargs -0 yamllint"
|
||||
|
||||
[flake8]
|
||||
# ignore below errors , will fix flake8 errors in future
|
||||
# H101 Use TODO(NAME)
|
||||
# H102 Apache 2.0 license header not found
|
||||
# H105 Don't use author tags
|
||||
# H306 imports not in alphabetical order
|
||||
# H401 docstring should not start with a space
|
||||
# H404 multi line docstring should start without a leading new line
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
# E501 line too long. skipped because some of the code files include templates
|
||||
# that end up quite wide
|
||||
# F401 'XXXXX' imported but unused
|
||||
# F841 local variable 'XXXXXX' is assigned to but never used
|
||||
show-source = True
|
||||
ignore = H101,H102,H105,H306,H401,H404,H405,E501,F401,F841
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||
# TODO: H106 Don’t put vim configuration in source files (off by default).
|
||||
# H203 Use assertIs(Not)None to check for None (off by default).
|
||||
# TODO: enable: H904 Delay string interpolations at logging calls (off by default).
|
||||
enable-extensions = H203
|
||||
max-line-length = 120
|
||||
|
||||
|
||||
# Use flake8 to replace pep8.
|
||||
[testenv:pep8]
|
||||
basepython = python3
|
||||
usedevelop = False
|
||||
skip_install = True
|
||||
commands =
|
||||
flake8
|
||||
whitelist_externals = cp
|
||||
find
|
||||
tox
|
||||
recreate = True
|
||||
commands = {[testenv]commands}
|
||||
tox -c tsconfig/tsconfig -e flake8
|
||||
tox -c cgcs-patch/cgcs-patch -e flake8
|
||||
tox -c patch-alarm/patch-alarm -e flake8
|
||||
|
||||
[testenv:venv]
|
||||
basepython = python3
|
||||
@ -101,6 +81,7 @@ recreate = True
|
||||
commands = {[testenv]commands}
|
||||
tox -c tsconfig/tsconfig -e py27
|
||||
tox -c cgcs-patch/cgcs-patch -e py27
|
||||
tox -c patch-alarm/patch-alarm -e py27
|
||||
|
||||
[testenv:py36]
|
||||
basepython = python3
|
||||
@ -112,28 +93,31 @@ recreate = True
|
||||
commands = {[testenv]commands}
|
||||
tox -c tsconfig/tsconfig -e py36
|
||||
tox -c cgcs-patch/cgcs-patch -e py36
|
||||
tox -c patch-alarm/patch-alarm -e py36
|
||||
|
||||
[testenv:pylint]
|
||||
deps = {[testenv]deps}
|
||||
pylint
|
||||
-e{toxinidir}/../config/sysinv/sysinv/sysinv
|
||||
-e{toxinidir}/../fault/fm-api
|
||||
pyCrypto
|
||||
daemon
|
||||
keystoneauth1
|
||||
keystonemiddleware
|
||||
mock
|
||||
netaddr
|
||||
oslo_config
|
||||
pecan
|
||||
requests
|
||||
requests_toolbelt
|
||||
rpm
|
||||
basepython = python2.7
|
||||
commands = pylint {[testenv]cgcs_patch_src_dir} \
|
||||
{[testenv]patch_alarm_src_dir} \
|
||||
{[testenv]tsconfig_src_dir} \
|
||||
--rcfile=./pylint.rc
|
||||
deps = {[testenv]deps}
|
||||
whitelist_externals = cp
|
||||
find
|
||||
tox
|
||||
recreate = True
|
||||
commands = {[testenv]commands}
|
||||
tox -c tsconfig/tsconfig -e pylint
|
||||
tox -c cgcs-patch/cgcs-patch -e pylint
|
||||
tox -c patch-alarm/patch-alarm -e pylint
|
||||
|
||||
[testenv:cover]
|
||||
basepython = python2.7
|
||||
deps = {[testenv]deps}
|
||||
whitelist_externals = cp
|
||||
find
|
||||
tox
|
||||
recreate = True
|
||||
commands = {[testenv]commands}
|
||||
tox -c tsconfig/tsconfig -e cover
|
||||
tox -c cgcs-patch/cgcs-patch -e cover
|
||||
tox -c patch-alarm/patch-alarm -e cover
|
||||
|
||||
[testenv:docs]
|
||||
basepython = python3
|
||||
|
218
tsconfig/tsconfig/pylint.rc
Executable file
218
tsconfig/tsconfig/pylint.rc
Executable file
@ -0,0 +1,218 @@
|
||||
[MASTER]
|
||||
# Specify a configuration file.
|
||||
rcfile=pylint.rc
|
||||
|
||||
# Python code to execute, usually for sys.path manipulation such as pygtk.require().
|
||||
#init-hook=
|
||||
|
||||
# Add files or directories to the blacklist. They should be base names, not paths.
|
||||
ignore=tests
|
||||
|
||||
# Pickle collected data for later comparisons.
|
||||
persistent=yes
|
||||
|
||||
# List of plugins (as comma separated values of python modules names) to load,
|
||||
# usually to register additional checkers.
|
||||
load-plugins=
|
||||
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time.
|
||||
#enable=
|
||||
|
||||
# Disable the message, report, category or checker with the given id(s). You
|
||||
# can either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once).
|
||||
# W0603 Using the global statement warning
|
||||
# W0612 Unused variable warning
|
||||
# W0613 Unused argument warning
|
||||
# W0702 bare-except
|
||||
# W0703 broad except warning
|
||||
# W1201 logging-not-lazy
|
||||
disable=C, R, W0603, W0612, W0613, W0702, W0703, W1201
|
||||
|
||||
|
||||
[REPORTS]
|
||||
# Set the output format. Available formats are text, parseable, colorized, msvs
|
||||
# (visual studio) and html
|
||||
output-format=text
|
||||
|
||||
# Put messages in a separate file for each module / package specified on the
|
||||
# command line instead of printing them on stdout. Reports (if any) will be
|
||||
# written in a file name "pylint_global.[txt|html]".
|
||||
files-output=no
|
||||
|
||||
# Tells whether to display a full report or only the messages
|
||||
reports=no
|
||||
|
||||
# Python expression which should return a note less than 10 (10 is the highest
|
||||
# note). You have access to the variables errors warning, statement which
|
||||
# respectively contain the number of errors / warnings messages and the total
|
||||
# number of statements analyzed. This is used by the global evaluation report
|
||||
# (RP0004).
|
||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
||||
|
||||
|
||||
[SIMILARITIES]
|
||||
# Minimum lines number of a similarity.
|
||||
min-similarity-lines=4
|
||||
|
||||
# Ignore comments when computing similarities.
|
||||
ignore-comments=yes
|
||||
|
||||
# Ignore docstrings when computing similarities.
|
||||
ignore-docstrings=yes
|
||||
|
||||
|
||||
[FORMAT]
|
||||
# Maximum number of characters on a single line.
|
||||
max-line-length=85
|
||||
|
||||
# Maximum number of lines in a module
|
||||
max-module-lines=1000
|
||||
|
||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
|
||||
indent-string=' '
|
||||
|
||||
|
||||
[TYPECHECK]
|
||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
||||
ignore-mixin-members=yes
|
||||
|
||||
# List of classes names for which member attributes should not be checked
|
||||
# (useful for classes with attributes dynamically set).
|
||||
ignored-classes=rpm
|
||||
|
||||
# List of members which are set dynamically and missed by pylint inference
|
||||
# system, and so shouldn't trigger E0201 when accessed. Python regular
|
||||
# expressions are accepted.
|
||||
generated-members=REQUEST,acl_users,aq_parent
|
||||
|
||||
|
||||
[BASIC]
|
||||
# List of builtins function names that should not be used, separated by a comma
|
||||
bad-functions=map,filter,apply,input
|
||||
|
||||
# Regular expression which should only match correct module names
|
||||
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||
|
||||
# Regular expression which should only match correct module level names
|
||||
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
||||
|
||||
# Regular expression which should only match correct class names
|
||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||
|
||||
# Regular expression which should only match correct function names
|
||||
function-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct method names
|
||||
method-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct instance attribute names
|
||||
attr-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct argument names
|
||||
argument-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct variable names
|
||||
variable-rgx=[a-z_][a-z0-9_]{2,30}$
|
||||
|
||||
# Regular expression which should only match correct list comprehension /
|
||||
# generator expression variable names
|
||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||
|
||||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=i,j,k,ex,Run,_
|
||||
|
||||
# Bad variable names which should always be refused, separated by a comma
|
||||
bad-names=foo,bar,baz,toto,tutu,tata
|
||||
|
||||
# Regular expression which should only match functions or classes name which do
|
||||
# not require a docstring
|
||||
no-docstring-rgx=__.*__
|
||||
|
||||
|
||||
[MISCELLANEOUS]
|
||||
# List of note tags to take in consideration, separated by a comma.
|
||||
notes=FIXME,XXX,TODO
|
||||
|
||||
|
||||
[VARIABLES]
|
||||
# Tells whether we should check for unused import in __init__ files.
|
||||
init-import=no
|
||||
|
||||
# A regular expression matching the beginning of the name of dummy variables
|
||||
# (i.e. not used).
|
||||
dummy-variables-rgx=_|dummy
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=
|
||||
|
||||
|
||||
[IMPORTS]
|
||||
# Deprecated modules which should not be used, separated by a comma
|
||||
deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
|
||||
|
||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
||||
# given file (report RP0402 must not be disabled)
|
||||
import-graph=
|
||||
|
||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
ext-import-graph=
|
||||
|
||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
||||
# not be disabled)
|
||||
int-import-graph=
|
||||
|
||||
|
||||
[DESIGN]
|
||||
# Maximum number of arguments for function / method
|
||||
max-args=5
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*
|
||||
|
||||
# Maximum number of locals for function / method body
|
||||
max-locals=15
|
||||
|
||||
# Maximum number of return / yield for function / method body
|
||||
max-returns=6
|
||||
|
||||
# Maximum number of branch for function / method body
|
||||
max-branches=12
|
||||
|
||||
# Maximum number of statements in function / method body
|
||||
max-statements=50
|
||||
|
||||
# Maximum number of parents for a class (see R0901).
|
||||
max-parents=7
|
||||
|
||||
# Maximum number of attributes for a class (see R0902).
|
||||
max-attributes=7
|
||||
|
||||
# Minimum number of public methods for a class (see R0903).
|
||||
min-public-methods=2
|
||||
|
||||
# Maximum number of public methods for a class (see R0904).
|
||||
max-public-methods=20
|
||||
|
||||
|
||||
[CLASSES]
|
||||
# List of method names used to declare (i.e. assign) instance attributes.
|
||||
defining-attr-methods=__init__,__new__,setUp
|
||||
|
||||
# List of valid names for the first argument in a class method.
|
||||
valid-classmethod-first-arg=cls
|
||||
|
||||
|
||||
[EXCEPTIONS]
|
||||
# Exceptions that will emit a warning when being caught. Defaults to
|
||||
# "Exception"
|
||||
overgeneral-exceptions=Exception
|
@ -1,5 +1,11 @@
|
||||
#
|
||||
# Copyright (c) 2019 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
[tox]
|
||||
envlist = py27,py36,cover
|
||||
envlist = flake8,py27,py36,pylint,cover
|
||||
minversion = 2.3.2
|
||||
|
||||
[testenv]
|
||||
@ -16,13 +22,52 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
whitelist_externals = find
|
||||
sh
|
||||
|
||||
[testenv:stestr]
|
||||
commands =
|
||||
find . -name "*.pyc" -delete
|
||||
stestr run {posargs}
|
||||
stestr slowest
|
||||
|
||||
whitelist_externals = find
|
||||
sh
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[testenv:py36]
|
||||
basepython = python3.6
|
||||
commands = {[testenv:stestr]commands}
|
||||
|
||||
[flake8]
|
||||
# ignore below errors , will fix flake8 errors in future
|
||||
# H102 Apache 2.0 license header not found
|
||||
# H306 imports not in alphabetical order
|
||||
# F401 'XXXXX' imported but unused
|
||||
show-source = True
|
||||
#ignore = H102,H306,F401
|
||||
ignore = H102,H306,F401
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,release-tag-*
|
||||
# TODO: H106 Don't put vim configuration in source files (off by default).
|
||||
# H203 Use assertIs(Not)None to check for None (off by default).
|
||||
# TODO: enable: H904 Delay string interpolations at logging calls (off by default).
|
||||
enable-extensions = H106 H203 H904
|
||||
max-line-length = 120
|
||||
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python2.7
|
||||
usedevelop = False
|
||||
skip_install = True
|
||||
commands =
|
||||
flake8 {posargs} .
|
||||
|
||||
[testenv:pylint]
|
||||
deps = {[testenv]deps}
|
||||
pylint
|
||||
basepython = python2.7
|
||||
|
||||
commands = pylint tsconfig --rcfile=./pylint.rc
|
||||
|
||||
[testenv:cover]
|
||||
setenv =
|
||||
|
Loading…
x
Reference in New Issue
Block a user