Commit 04f9ad28 authored by Jérome Perrin's avatar Jérome Perrin

software/slapos-testing: check code with pylint (and also shellcheck)

parent 667d73b1
Pipeline #20555 failed with stage
in 0 seconds
......@@ -15,4 +15,4 @@
[template]
filename = instance.cfg
md5sum = ba6c572678687081ce111d3805be3cee
md5sum = ab9fc4f09488ab5c20ed2e441000d6fb
......@@ -82,17 +82,51 @@ repository = ${slapos.rebootstrap-repository:location}
<= download-source
repository = ${rubygemsrecipe-repository:location}
[default-pylintrc]
recipe = slapos.recipe.template:jinja2
rendered = $${create-directory:etc}/$${:_buildout_section_name_}
template =
inline:
[REPORTS]
reports = no
score = no
[MESSAGES CONTROL]
disable =
W,
R,
C,
I,
no-member,
no-name-in-module
enable =
assert-on-tuple,
duplicate-key,
logging-not-lazy,
mixed-indentation,
unused-variable,
unused-import,
redundant-unittest-assert,
useless-suppression
# [TYPECHECK]
# # XXX can we do better than this ?
# ignored-modules = zc, zope
[slapos-test-runner-nxdtest-environment.sh]
recipe = slapos.recipe.template:jinja2
rendered = $${create-directory:etc}/$${:_buildout_section_name_}
template = inline:
export HOME=$${buildout:directory}
export PATH=${coreutils:location}/bin:${curl:location}/bin:${openssl:location}/bin:${jq:location}/bin:${sed:location}/bin:${grep:location}/bin:${git:location}/bin:${libxslt:location}/bin:${socat:location}/bin:${lmsensors:location}/bin:${rsync:location}/bin/:${buildout:bin-directory}:$PATH
export PATH=${shellcheck:location}/bin/:$PATH
export SLAPOS_TEST_IPV4=$${slap-configuration:ipv4-random}
export SLAPOS_TEST_IPV6=$${slap-configuration:ipv6-random}
export SLAPOS_TEST_EGGS_DIRECTORY=$${buildout:eggs-directory}
export SLAPOS_TEST_DEVELOP_EGGS_DIRECTORY=$${buildout:develop-eggs-directory}
export SLAPOS_TEST_POSTGRESQL_PREFIX=${postgresql:location}
export PYLINTRC=$${default-pylintrc:rendered}
[slapos-test-runner-dot-nxdtest]
......@@ -100,25 +134,54 @@ recipe = slapos.recipe.template:jinja2
rendered = $${:workdir}/.nxdtest
workdir = $${create-directory:nxdtest-working-dir}
template = inline:
template =
inline:
import glob
import sys
TestCase(
"kedifa",
['python', '-m', 'unittest', 'discover', '-v'],
cwd="""$${kedifa:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"kedifa:pylint",
['python', '-m', 'pylint', 'kedifa'],
cwd="""$${kedifa:location}""",
summaryf=PyLint.summary,
)
TestCase(
"caucase",
['$${caucase-test-runner:rendered}'],
cwd="""$${caucase:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"caucase:pylint",
['python', '-m', 'pylint', 'caucase'],
cwd="""$${caucase:location}""",
summaryf=PyLint.summary,
)
TestCase(
"caucase:shellcheck",
['shellcheck', 'shell/caucase.sh'],
cwd="""$${caucase:location}""",
)
TestCase(
"erp5.util",
['python', '-m', 'unittest', 'discover', '-v', '--start', 'erp5/tests/'],
cwd="""$${erp5.util:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"erp5.util:pylint",
['python', '-m', 'pylint', 'erp5'],
cwd="""$${erp5.util:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.cookbook",
# slapos/test contain both tests for recipes and tests for
......@@ -128,6 +191,13 @@ template = inline:
cwd="""$${slapos.cookbook:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.cookbook:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.cookbook:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.core",
# ['python', '-m', 'unittest', 'discover', '-v'],
......@@ -138,18 +208,39 @@ template = inline:
cwd="""$${slapos.core:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.core:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.core:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.recipe.build",
['python', '-m', 'unittest', 'discover', '-v'],
cwd="""$${slapos.recipe.build:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.recipe.build:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.recipe.build:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.recipe.cmmi",
['python', '-m', 'unittest', 'discover', '-v'],
cwd="""$${slapos.recipe.cmmi:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.recipe.cmmi:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.recipe.cmmi:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.recipe.template",
# ['python', '-m', 'unittest', 'slapos.recipe.template.tests.test_suite'],
......@@ -158,6 +249,13 @@ template = inline:
cwd="""$${slapos.recipe.template:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.recipe.template:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.recipe.template:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.toolbox",
# ['python', '-m', 'unittest', 'discover', '-v'],
......@@ -171,24 +269,52 @@ template = inline:
cwd="""$${slapos.toolbox:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.toolbox:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.toolbox:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.libnetworkcache",
['python', '-m', 'unittest', '-v', 'slapos.libnetworkcachetests'],
cwd="""$${slapos.libnetworkcache:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.libnetworkcache:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.libnetworkcache:location}""",
summaryf=PyLint.summary,
)
TestCase(
"slapos.rebootstrap",
['python', '-m', 'unittest', '-v', 'slapos.rebootstrap.tests.test_suite'],
cwd="""$${slapos.rebootstrap:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"slapos.rebootstrap:pylint",
['python', '-m', 'pylint', 'slapos'],
cwd="""$${slapos.rebootstrap:location}""",
summaryf=PyLint.summary,
)
TestCase(
"rubygemsrecipe",
['python', '-m', 'unittest', 'discover', '-v'],
cwd="""$${rubygemsrecipe:location}""",
summaryf=UnitTest.summary,
)
if sys.version_info >= (3, ):
TestCase(
"rubygemsrecipe:pylint",
['python', '-m', 'pylint', 'tests', ] + glob.glob("""$${rubygemsrecipe:location}/*.py"""),
cwd="""$${rubygemsrecipe:location}""",
summaryf=UnitTest.summary,
)
[runTestSuite]
env.sh = $${slapos-test-runner-nxdtest-environment.sh:rendered}
......
......@@ -4,3 +4,19 @@ extends =
[python]
part = python3
[pylint]
patches =
[versions:python3]
pylint = 2.12.1
typing-extensions = 4.0.0:whl
toml = 0.10.2
mccabe = 0.6.1:whl
isort = 5.10.1
astroid = 2.9.0
platformdirs = 2.4.0:whl
typed-ast = 1.5.0
wrapt = 1.13.3
lazy-object-proxy = 1.6.0:whl
......@@ -19,6 +19,7 @@ extends =
../../component/userhosts/buildout.cfg
../../component/postgresql/buildout.cfg
../../component/psycopg2/buildout.cfg
../../component/pylint/buildout.cfg
../../stack/slapos.cfg
../../stack/caucase/buildout.cfg
../../stack/nxdtest.cfg
......@@ -29,6 +30,14 @@ parts =
eggs/scripts
phantomjs
template
shellcheck
[shellcheck:linux and platform.machine() == 'x86_64']
recipe = slapos.recipe.build:download-unpacked
url = https://github.com/koalaman/shellcheck/releases/download/v0.8.0/shellcheck-v0.8.0.linux.aarch64.tar.xz
md5sum = a0338c733d1283a51777b27edf9ccc96
environment =
PATH=${xz-utils:location}/bin/:%(PATH)s
[bootstrap-slapos.recipe.cmmi]
# install our develop version of slapos.recipe.cmmi before anything else,
......@@ -120,6 +129,7 @@ eggs +=
${backports.lzma:egg}
${pycurl:egg}
${bcrypt:egg}
${pylint:egg}
dnspython
Jinja2
${kedifa-setup:egg}
......@@ -143,6 +153,7 @@ eggs = ${eggs:eggs}
scripts =
slapos
supervisord
pylint
[git-clone-repository]
recipe = slapos.recipe.build:gitclone
......@@ -234,12 +245,10 @@ slapos.core =
slapos.toolbox =
rubygemsrecipe =
# All other depencies should be pinned.
Pygments = 2.1.3
zc.lockfile = 1.4
bcrypt = 3.1.4
dnspython = 1.15.0
funcsigs = 1.0.2
httmock = 1.2.6
manuel = 1.9.0
mock = 2.0.0:whl
......@@ -247,6 +256,10 @@ testfixtures = 6.11.0
pycurl = 7.43.0.2
pyflakes = 2.0.0
zope.testing = 4.6.2
urllib3 = 1.24.1
pathlib = 1.0.1
psycopg2 = 2.8.6
[versions:python2]
pylint = 1.4.4
astroid = 1.3.8
logilab-common = 1.3.0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment