From 3bba29d4f48e9008c8a65aa6101d0e82487bd257 Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Wed, 15 Feb 2023 15:48:01 +0000 Subject: [PATCH] Run tests daily, update tox.ini Ported from https://github.com/canonical/mysql-k8s-operator/pull/146 --- .github/workflows/ci.yaml | 14 +++++++++----- tests/integration/__init__.py | 2 ++ tox.ini | 27 +++++++++++++-------------- 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 tests/integration/__init__.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5fa8972f..e011009e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,10 +1,13 @@ -name: integration and other tests +# Copyright 2022 Canonical Ltd. +# See LICENSE file for licensing details. +name: Tests on: - workflow_call: pull_request: schedule: - - cron: '0 12 * * 3' + - cron: '53 0 * * *' # Daily at 00:53 UTC + # Triggered on push to branch "main" by .github/workflows/release.yaml + workflow_call: jobs: lint: @@ -13,7 +16,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Install dependencies + - name: Install tox + # TODO: Consider replacing with custom image on self-hosted runner OR pinning version run: python3 -m pip install tox - name: Run linters - run: tox -e lint + run: tox run -e lint diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py new file mode 100644 index 00000000..db3bfe1a --- /dev/null +++ b/tests/integration/__init__.py @@ -0,0 +1,2 @@ +# Copyright 2023 Canonical Ltd. +# See LICENSE file for licensing details. diff --git a/tox.ini b/tox.ini index bb4e00db..78a7010d 100644 --- a/tox.ini +++ b/tox.ini @@ -2,25 +2,25 @@ # See LICENSE file for licensing details. [tox] -skipsdist=True +no_package = True skip_missing_interpreters = True -envlist = lint, unit +env_list = lint, unit [vars] -tst_path = {toxinidir}/tests/ -all_path = {toxinidir} +tests_path = {tox_root}/tests +all_path = {[vars]tests_path} [testenv] -setenv = - PYTHONPATH = {toxinidir}:{toxinidir}/lib +set_env = + PYTHONPATH = {tox_root}/lib PYTHONBREAKPOINT=ipdb.set_trace PY_COLORS=1 -passenv = +pass_env = PYTHONPATH CHARM_BUILD_DIR MODEL_SETTINGS -[testenv:fmt] +[testenv:format] description = Apply coding style standards to code deps = black @@ -42,9 +42,9 @@ deps = isort codespell commands = - codespell {toxinidir} --skip {toxinidir}/.git --skip {toxinidir}/.tox \ - --skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \ - --skip {toxinidir}/.mypy_cache --skip {toxinidir}/LICENSE + codespell {tox_root} --skip {tox_root}/.git --skip {tox_root}/.tox \ + --skip {tox_root}/build --skip {tox_root}/lib --skip {tox_root}/venv \ + --skip {tox_root}/.mypy_cache --skip {tox_root}/LICENSE # pflake8 wrapper supports config from pyproject.toml pflake8 {[vars]all_path} isort --check-only --diff {[vars]all_path} @@ -56,7 +56,6 @@ deps = juju=2.9.38.1 pytest pytest-operator>0.17.0 - -r{toxinidir}/requirements.txt + -r {tox_root}/requirements.txt commands = - pytest -v --tb native --ignore={[vars]tst_path}unit --log-cli-level=INFO -s {posargs} \ - --durations=0 + pytest -v --tb native --log-cli-level=INFO -s {posargs} {[vars]tests_path}/integration/test_bundle.py