From deac768c9b83efd441f515d7f2d921e28f71668b Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 7 Jun 2021 22:28:34 +0200 Subject: [PATCH] ci: add python file checks to ci --- .drone.jsonnet | 22 ++++++++++++++++++++++ .drone.yml | 18 +++++++++++++++++- molecule/centos7/tests/test_default.py | 8 ++------ 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 7eb7c0b..ecf6cd6 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -13,6 +13,28 @@ local PipelineLinting = { 'ansible-later', ], }, + { + name: 'python-format', + image: 'python:3.9', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install -qq yapf', + 'yapf -dr ./', + ], + }, + { + name: 'python-flake8', + image: 'python:3.9', + environment: { + PY_COLORS: 1, + }, + commands: [ + 'pip install -qq flake8', + 'flake8', + ], + }, ], trigger: { ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], diff --git a/.drone.yml b/.drone.yml index b629310..7aa4551 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,22 @@ steps: commands: - ansible-later +- name: python-format + image: python:3.9 + commands: + - pip install -qq yapf + - yapf -dr ./ + environment: + PY_COLORS: 1 + +- name: python-flake8 + image: python:3.9 + commands: + - pip install -qq flake8 + - flake8 + environment: + PY_COLORS: 1 + trigger: ref: - refs/heads/master @@ -131,6 +147,6 @@ depends_on: --- kind: signature -hmac: 25d777600b0cab51533bb722f1bf38e33d3b4456888c71cda69355c88de7e908 +hmac: 52a5f3d309a5d7f4504cc5580cee7472289506b460eb18ec4f00e8b42766b033 ... diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index fe95098..dcf3303 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -2,13 +2,9 @@ import os import testinfra.utils.ansible_runner -import warnings - -warnings.filterwarnings("ignore", category=DeprecationWarning) - testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( - os.environ['MOLECULE_INVENTORY_FILE'] -).get_hosts('all') + os.environ["MOLECULE_INVENTORY_FILE"] +).get_hosts("all") def test_unifi_running_and_enabled(host):