From 66de0ba96acf6db03e183ddc970afa9b8e6fcd17 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Thu, 10 Oct 2019 16:38:52 +0200 Subject: [PATCH] Initial commit --- .gitignore | 8 +++++ .stestr.conf | 3 ++ .travis.yml | 14 ++++++++ src/README.md | 2 ++ test-requirements.txt | 13 +++++++ tox.ini | 80 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 120 insertions(+) create mode 100644 .gitignore create mode 100644 .stestr.conf create mode 100644 .travis.yml create mode 100644 src/README.md create mode 100644 test-requirements.txt create mode 100644 tox.ini diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f71a88 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.tox +.stestr +*__pycache__* +*.pyc +build +interfaces +layers +*.swp diff --git a/.stestr.conf b/.stestr.conf new file mode 100644 index 0000000..5fcccac --- /dev/null +++ b/.stestr.conf @@ -0,0 +1,3 @@ +[DEFAULT] +test_path=./unit_tests +top_dir=./ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d974b45 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +sudo: true +dist: xenial +language: python +install: pip install tox-travis +matrix: + include: + - name: "Python 3.6" + python: 3.6 + env: ENV=pep8 + - name: "Python 3.7" + python: 3.7 + env: ENV=pep8 +script: + - tox -c tox.ini -e $ENV diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..c4d6486 --- /dev/null +++ b/src/README.md @@ -0,0 +1,2 @@ +This charm is built from the source of the `charm-ovn-chassis` charm and this +directory is thus empty. diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..14b380e --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,13 @@ +# This file is managed centrally. If you find the need to modify this as a +# one-off, please don't. Intead, consult #openstack-charms and ask about +# requirements management in charms via bot-control. Thank you. +# +# Lint and unit test requirements +flake8>=2.2.4,<=2.4.1 +stestr>=2.2.0 +requests>=2.18.4 +charms.reactive +mock>=1.2 +nose>=1.3.7 +coverage>=3.6 +git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..ee3f06d --- /dev/null +++ b/tox.ini @@ -0,0 +1,80 @@ +# Source charm: ./tox.ini +# This file is managed centrally by release-tools and should not be modified +# within individual charm repos. +[tox] +skipsdist = True +envlist = pep8 + +[testenv] +setenv = VIRTUAL_ENV={envdir} + PYTHONHASHSEED=0 + TERM=linux + CHARM_LAYERS_DIR={toxinidir}/layers + CHARM_INTERFACES_DIR={toxinidir}/interfaces + JUJU_REPOSITORY={toxinidir}/build +passenv = http_proxy https_proxy INTERFACE_PATH +install_command = + pip install {opts} {packages} +deps = + -r{toxinidir}/requirements.txt + +[testenv:build] +basepython = python3 +commands = + charm-build --log-level DEBUG -o {toxinidir}/build src {posargs} + +[testenv:py3] +basepython = python3 +deps = -r{toxinidir}/test-requirements.txt +commands = stestr run {posargs} + +[testenv:py35] +basepython = python3.5 +deps = -r{toxinidir}/test-requirements.txt +commands = stestr run {posargs} + +[testenv:py36] +basepython = python3.6 +deps = -r{toxinidir}/test-requirements.txt +commands = stestr run {posargs} + +[testenv:pep8] +basepython = python3 +deps = -r{toxinidir}/test-requirements.txt +commands = flake8 {posargs} src + +[testenv:cover] +# Technique based heavily upon +# https://github.com/openstack/nova/blob/master/tox.ini +basepython = python3 +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +setenv = + {[testenv]setenv} + PYTHON=coverage run +commands = + coverage erase + stestr run {posargs} + coverage combine + coverage html -d cover + coverage xml -o cover/coverage.xml + coverage report + +[coverage:run] +branch = True +concurrency = multiprocessing +parallel = True +source = + . +omit = + .tox/* + */charmhelpers/* + unit_tests/* + +[testenv:venv] +basepython = python3 +commands = {posargs} + +[flake8] +# E402 ignore necessary for path append before sys module import in actions +ignore = E402