Setup unit tests

This commit is contained in:
Nikita Zubkov 2016-07-13 12:54:27 +03:00
parent fda72a25ef
commit 018076c2b3
6 changed files with 63 additions and 17 deletions

2
.gitignore vendored
View File

@ -55,4 +55,4 @@ ChangeLog
.*sw?
# Files created by releasenotes build
releasenotes/build
extension.xml

24
conftest.py Normal file
View File

@ -0,0 +1,24 @@
# coding: utf-8
# 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.
def pytest_configure(config):
from nailgun import db
db.dropdb()
db.syncdb()
def pytest_unconfigure(config):
from nailgun import db
db.dropdb()

View File

@ -0,0 +1,15 @@
DEVELOPMENT: 1
DATABASE:
name: "openstack_citest"
engine: "postgresql"
host: "localhost"
port: "5432"
user: "openstack_citest"
passwd: "openstack_citest"
API_LOG: "logs/api.log"
APP_LOG: "logs/app.log"
APP_LOGLEVEL: "ERROR"
RPC_CONSUMER_LOG_PATH: "logs/receiverd.log"
ASSASSIN_LOG_PATH: "logs/assassind.log"
STATS_LOGS_PATH: "logs/"
LCM_SERIALIZERS_CONCURRENCY_FACTOR: 1

View File

@ -1,11 +1,9 @@
[metadata]
name = fuel-nailgun-extension-cluster-upgrade
summary = Cluster upgrade extension for Fuel
description-file =
README.rst
author = OpenStack
author-email = openstack-dev@lists.openstack.org
home-page = http://www.openstack.org/
author = Mirantis Inc.
author-email = product@mirantis.com
home-page = http://mirantis.com
classifier =
Environment :: OpenStack
Intended Audience :: Information Technology

View File

@ -2,5 +2,5 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0
hacking
pytest

29
tox.ini
View File

@ -3,21 +3,30 @@ minversion = 2.0
envlist = pep8,py27
skipsdist = True
[base]
NAILGUN_REPO = git+https://github.com/zubchick/fuel-web.git
NAILGUN_CONFIG = {toxinidir}/nailgun-test-settings.yaml
NAILGUN_BRANCH={env:ZUUL_BRANCH:master}
[testenv]
usedevelop = True
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = true
commands = true
setenv = VIRTUAL_ENV={envdir}
[testenv:py27]
usedevelop = True
deps = {[testenv]deps}
-r{toxinidir}/requirements.txt
-e{[base]NAILGUN_REPO}@{[base]NAILGUN_BRANCH}#egg=nailgun[test]&subdirectory=nailgun
setenv = {[testenv]setenv}
NAILGUN_CONFIG={[base]NAILGUN_CONFIG}
commands = py.test -v --junit-xml {toxinidir}/extension.xml {posargs}
[testenv:pep8]
commands = flake8 {posargs}
[testenv:py27]
deps = {[testenv]deps}
-r{toxinidir}/requirements.txt
[testenv:venv]
commands = {posargs}
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
@ -26,4 +35,4 @@ deps = {[testenv]deps}
show-source = True
ignore = E123,E125,H101,H304
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build