commit c3e5adcb4d617f306d3ce026b2289aafeb6fdf97 Author: Chris MacNaughton Date: Mon Dec 4 17:01:09 2017 +0100 initial commit framing out stuff diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..84b0fbb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.tox +*.pyc \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..ca34e90 --- /dev/null +++ b/setup.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function + +import os +import sys +from setuptools import setup, find_packages +from setuptools.command.test import test as TestCommand + +version = "0.0.1.dev1" +install_require = [ +] + +tests_require = [ + 'tox >= 2.3.1', +] + + +class Tox(TestCommand): + user_options = [('tox-args=', 'a', "Arguments to pass to tox")] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.tox_args = None + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + #import here, cause outside the eggs aren't loaded + import tox + import shlex + args = self.tox_args + # remove the 'test' arg from argv as tox passes it to ostestr which + # breaks it. + sys.argv.pop() + if args: + args = shlex.split(self.tox_args) + errno = tox.cmdline(args=args) + sys.exit(errno) + + +if sys.argv[-1] == 'publish': + os.system("python setup.py sdist upload") + os.system("python setup.py bdist_wheel upload") + sys.exit() + + +if sys.argv[-1] == 'tag': + os.system("git tag -a %s -m 'version %s'" % (version, version)) + os.system("git push --tags") + sys.exit() + + +setup( + name='zaza', + version=version, + description='Provides test automation for Openstack Charms', + classifiers=[ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "Topic :: System", + "Topic :: System :: Installation/Setup", + "Topic :: System :: Software Distribution", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "License :: OSI Approved :: Apache Software License", + ], + entry_points={ + 'console_scripts': [ + 'tempest-config = zaza.tempest_config:main', + ] + }, + url='https://github.com/openstack-charmers/zaza', + author='Chris MacNaughton', + author_email='chris.macnaughton@canonical.com', + license='Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0', + packages=find_packages(exclude=["unit_tests"]), + zip_safe=False, + cmdclass={'test': Tox}, + install_requires=install_require, + extras_require={ + 'testing': tests_require, + }, + tests_require=tests_require, +) \ No newline at end of file diff --git a/test-requirements.txt b/test-requirements.txt new file mode 100644 index 0000000..ce87c70 --- /dev/null +++ b/test-requirements.txt @@ -0,0 +1,3 @@ +flake8>=2.2.4,<=2.4.1 +mock>=1.2 +nose>=1.3.7 \ No newline at end of file diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..6fcaae0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,34 @@ +[tox] +envlist = pep8,py27,py34,py35,py36 +skipsdist = True +skip_missing_interpreters = True + +[testenv] +setenv = VIRTUAL_ENV={envdir} + PYTHONHASHSEED=0 +install_command = + pip install --allow-unverified python-apt {opts} {packages} +commands = nosetests {posargs} {toxinidir}/unit_tests + +[testenv:py34] +basepython = python3.4 +deps = -r{toxinidir}/test-requirements.txt + +[testenv:py35] +basepython = python3.5 +deps = -r{toxinidir}/test-requirements.txt + +[testenv:py36] +basepython = python3.6 +deps = -r{toxinidir}/test-requirements.txt + +[testenv:pep8] +basepython = python3.6 +deps = -r{toxinidir}/test-requirements.txt +commands = flake8 {posargs} zaza unit_tests + +[testenv:venv] +commands = {posargs} + +[flake8] +ignore = E402,E226 \ No newline at end of file diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/zaza/__init__.py b/zaza/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/zaza/tempest_config.py b/zaza/tempest_config.py new file mode 100644 index 0000000..a80ba96 --- /dev/null +++ b/zaza/tempest_config.py @@ -0,0 +1,22 @@ +import argparse +import zaza + + +def parser(args=None): + parser = argparse.ArgumentParser( + description='build tempest config from currently deployed model') + parser.add_argument('blacklist', + help='Comma seperated list of' + 'additional tests to ignore', + default='', nargs='?') + return parser.parse_known_args(args) + + +def main(): + a, extra = parser() + blacklist = list(filter(bool, a.blacklist.split(","))) + print("Starting with blacklist of {}".format(blacklist)) + + +if __name__ == '__main__': + main() \ No newline at end of file