diff --git a/charms/ovn-central-k8s/.github/workflows/tox.yaml b/charms/ovn-central-k8s/.github/workflows/tox.yaml new file mode 100644 index 00000000..ddfeff1e --- /dev/null +++ b/charms/ovn-central-k8s/.github/workflows/tox.yaml @@ -0,0 +1,27 @@ +name: Python package + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8, 3.9] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Lint with tox + run: tox -e pep8 + - name: Test with tox + run: tox -e py${{ matrix.python-version }} diff --git a/charms/ovn-central-k8s/tests/__init__.py b/charms/ovn-central-k8s/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/charms/ovn-central-k8s/tests/test_charm.py b/charms/ovn-central-k8s/tests/test_charm.py deleted file mode 100644 index fa1ebfeb..00000000 --- a/charms/ovn-central-k8s/tests/test_charm.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2022 liam -# See LICENSE file for licensing details. -# -# Learn more about testing at: https://juju.is/docs/sdk/testing - -import unittest -from unittest.mock import Mock - -from charm import SunbeamOvnCentralOperatorCharm -from ops.testing import Harness - - -class TestCharm(unittest.TestCase): - def setUp(self): - self.harness = Harness(SunbeamOvnCentralOperatorCharm) - self.addCleanup(self.harness.cleanup) - self.harness.begin() - - def test_config_changed(self): - self.assertEqual(list(self.harness.charm._stored.things), []) - self.harness.update_config({"thing": "foo"}) - self.assertEqual(list(self.harness.charm._stored.things), ["foo"]) - - def test_action(self): - # the harness doesn't (yet!) help much with actions themselves - action_event = Mock(params={"fail": ""}) - self.harness.charm._on_fortune_action(action_event) - - self.assertTrue(action_event.set_results.called) - - def test_action_fail(self): - action_event = Mock(params={"fail": "fail this"}) - self.harness.charm._on_fortune_action(action_event) diff --git a/charms/ovn-central-k8s/tox.ini b/charms/ovn-central-k8s/tox.ini index 31301b80..987807e9 100644 --- a/charms/ovn-central-k8s/tox.ini +++ b/charms/ovn-central-k8s/tox.ini @@ -35,26 +35,16 @@ whitelist_externals = passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt -[testenv:py35] -basepython = python3.5 -# python3.5 is irrelevant on a focal+ charm. -commands = /bin/true - -[testenv:py36] -basepython = python3.6 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -[testenv:py37] -basepython = python3.7 -deps = -r{toxinidir}/requirements.txt - -r{toxinidir}/test-requirements.txt - -[testenv:py38] +[testenv:py3.8] basepython = python3.8 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt +[testenv:py3.9] +basepython = python3.9 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + [testenv:py3] basepython = python3 deps = -r{toxinidir}/requirements.txt