From 05acd5e750daccfa67308ed4f7d52964a245b65a Mon Sep 17 00:00:00 2001 From: Alberto Gonzalez Date: Fri, 26 Apr 2024 10:38:50 +0200 Subject: [PATCH] Add tox jobs This change adds tox jobs that lint and test python code. Together with the job definition and configuration, this change adds some dummy directories and tests that should be replaced once the actual code for this repo is migrated. Change-Id: Iaa201562faf2dbee0647b3366d6d0c5ece0561d0 --- powertrain_build/__init__.py | 0 test-requirements.txt | 2 ++ tests/__init__.py | 0 tests/test_dummy.py | 2 ++ tox.ini | 25 +++++++++++++++++++++++++ zuul.d/projects.yaml | 2 ++ zuul.d/tox.yaml | 5 +++++ 7 files changed, 36 insertions(+) create mode 100644 powertrain_build/__init__.py create mode 100644 test-requirements.txt create mode 100644 tests/__init__.py create mode 100644 tests/test_dummy.py create mode 100644 tox.ini create mode 100644 zuul.d/tox.yaml diff --git a/powertrain_build/__init__.py b/powertrain_build/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..d34f985 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,2 @@ +pytest +flake8 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_dummy.py b/tests/test_dummy.py new file mode 100644 index 0000000..c652251 --- /dev/null +++ b/tests/test_dummy.py @@ -0,0 +1,2 @@ +def test_dummy(): + assert 1 == 1 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..15625bd --- /dev/null +++ b/tox.ini @@ -0,0 +1,25 @@ +[tox] +skipsdist = True +requires = + tox >= 2.0 + +[flake8] +exclude = + .git, + __pycache__, + *.pyc, + .cache, + .tox +max-line-length = 120 + +[testenv] +platform = linux +basepython = python3 +deps = + -rtest-requirements.txt + +[testenv:flake8] +commands = flake8 powertrain_build tests + +[testenv:pytest] +commands = python -m pytest tests diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml index db19168..d9e878d 100644 --- a/zuul.d/projects.yaml +++ b/zuul.d/projects.yaml @@ -1,7 +1,9 @@ - project: check: jobs: + - powertrain-build-tox - noop gate: jobs: + - powertrain-build-tox - noop diff --git a/zuul.d/tox.yaml b/zuul.d/tox.yaml new file mode 100644 index 0000000..ca00e74 --- /dev/null +++ b/zuul.d/tox.yaml @@ -0,0 +1,5 @@ +- job: + name: powertrain-build-tox + parent: tox + vars: + tox_envlist: flake8,pytest