From 2de1ad06eb882bc28020833f562052a1ade0656d Mon Sep 17 00:00:00 2001 From: ssorenso Date: Mon, 17 Apr 2017 10:15:36 -0600 Subject: [PATCH] Issues: Fixes #1 Problem: The issue is that there does not exist any test automation for continuous integration via Travis. Analysis: This initiates the test automation via Travis. This is a very vanilla setup with no entrypoint and only minimal items for tox to work with both commands that are in the .travis_yml file. This includes the setup for travis and the basic framework around getting .rpm and .deb installed via test automation in the framework. Tests: There exists a f5_cccl/test/test_f5_cccl.py which is a basic test to validate that there exists a __version__ variable. --- .git-commit-template.txt | 15 +++++++++++++ .travis.yml | 24 +++++++++++++++++++++ f5_cccl/__init__.py | 17 +++++++++++++++ f5_cccl/test/test_f5_cccl.py | 21 ++++++++++++++++++ requirements.docs.txt | 6 ++++++ requirements.test.txt | 12 +++++++++++ setup.py | 41 ++++++++++++++++++++++++++++++++++++ tox.ini | 27 ++++++++++++++++++++++++ 8 files changed, 163 insertions(+) create mode 100644 .git-commit-template.txt create mode 100644 .travis.yml create mode 100644 f5_cccl/__init__.py create mode 100644 f5_cccl/test/test_f5_cccl.py create mode 100644 requirements.docs.txt create mode 100644 requirements.test.txt create mode 100644 setup.py create mode 100644 tox.ini diff --git a/.git-commit-template.txt b/.git-commit-template.txt new file mode 100644 index 00000000..b40b5f3b --- /dev/null +++ b/.git-commit-template.txt @@ -0,0 +1,15 @@ +# Headline or summary of the issue you are fixing + +# Using the Fixes # will close the issue on commit to repo +Issues: +Fixes # + +# Describe the issue that this change addresses +Problem: + +# Describe the change itself and why you made the changes you did +Analysis: + +# Describe the tests you ran and/or created to test this change +Tests: + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..b7c747d9 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: python +python: + - "2.7" + - "3.5" +sudo: true +env: + global: + - REPO="f5-cccl" + - PKG_VERSION=$(python -c "import f5_cccl; print f5_cccl.__version__") +# services: # needed for later work to build .deb and .rpm natively +# - docker +before_install: + - git config --global user.email "OpenStack_TravisCI@f5.com" + - git config --global user.name "Travis F5 Openstack" + - git fetch --depth=100 +install: + - pip install tox + - pip install -r requirements.test.txt + - pip install -r requirements.docs.txt + - python ./setup.py install +script: + - tox -e flake + - tox -e unit +before_deploy: PKG_VERSION=$(python -c "import f5; print(f5_cccl.__version__)") diff --git a/f5_cccl/__init__.py b/f5_cccl/__init__.py new file mode 100644 index 00000000..7f8cd3f0 --- /dev/null +++ b/f5_cccl/__init__.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# Copyright 2017 F5 Networks Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +__version__ = '0.0.0' diff --git a/f5_cccl/test/test_f5_cccl.py b/f5_cccl/test/test_f5_cccl.py new file mode 100644 index 00000000..bb74b5d6 --- /dev/null +++ b/f5_cccl/test/test_f5_cccl.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +# Copyright 2017 F5 Networks Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import f5_cccl + + +def test_version(): + assert isinstance(f5_cccl.__version__, str) diff --git a/requirements.docs.txt b/requirements.docs.txt new file mode 100644 index 00000000..4870b9c9 --- /dev/null +++ b/requirements.docs.txt @@ -0,0 +1,6 @@ +-e . + +# Docs requirements +Sphinx>=1.4.1 +six>=1.10.0 +sphinx_rtd_theme diff --git a/requirements.test.txt b/requirements.test.txt new file mode 100644 index 00000000..5ca9c308 --- /dev/null +++ b/requirements.test.txt @@ -0,0 +1,12 @@ +# Install this directory (will use setup.py and therefore install_requires). +-e . +# Test Requirements +mock==2.0.0 +pytest==3.0.5 +pytest-cov>=2.2.1 +python-coveralls==2.7.0 +pyOpenSSL==16.2.0 +requests-mock==1.2.0 +flake8 +netaddr +q diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..af459031 --- /dev/null +++ b/setup.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +# Copyright 2014 F5 Networks Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import f5_cccl + +from setuptools import find_packages +from setuptools import setup + +install_requires = [] +print('install_requires', install_requires) +setup( + name='f5-cccl', + description='F5 Networks Common Controller Core Library', + license='Apache License, Version 2.0', + version=f5_cccl.__version__, + author='F5 Networks', + url='https://github.com/f5devcentral/f5-cccl', + keywords=['F5', 'big-ip'], + install_requires=install_requires, + packages=find_packages( + exclude=["*.test", "*.test.*", "test.*", "test_*", "test", "test*"] + ), + data_files=[], + classifiers=[ + ], + entry_points={} +) diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..75c756ad --- /dev/null +++ b/tox.ini @@ -0,0 +1,27 @@ +[tox] +envlist = + unit + flake + coveralls + docs + +[testenv] +basepython = + unit: python + flake: python + coveralls: python + docs: python +passenv = COVERALLS_REPO_TOKEN +deps = + -rrequirements.test.txt + +commands = + # Misc tests + flake: flake8 {posargs:.} + unit: py.test f5_cccl/ + coveralls: coveralls + docs: bash ./devtools/bin/build-docs.sh +usedevelop = true + +[flake8] +exclude = docs/conf.py,docs/userguide/code_example.py,docs/conf.py,.tox,.git,__pycache__,build,*.pyc,docs,devtools,*.tmpl