Add first test and update setup and tox to use it
Change-Id: Ife7d37588523029335045f9c647e1eaaf463a66e
This commit is contained in:
parent
a4fed99239
commit
2a5c51572b
@ -8,3 +8,6 @@ upload-dir = doc/build/html
|
|||||||
|
|
||||||
[bdist_rpm]
|
[bdist_rpm]
|
||||||
requires = python >= 2.6
|
requires = python >= 2.6
|
||||||
|
|
||||||
|
[aliases]
|
||||||
|
test = pytest
|
||||||
|
2
setup.py
2
setup.py
@ -48,4 +48,6 @@ setup(name=pname,
|
|||||||
data_files=rqfiles,
|
data_files=rqfiles,
|
||||||
include_package_data=package_data,
|
include_package_data=package_data,
|
||||||
entry_points={'console_scripts': ['%s=%s.cli:main' % (pname, pname)]},
|
entry_points={'console_scripts': ['%s=%s.cli:main' % (pname, pname)]},
|
||||||
|
setup_requires=['pytest-runner'],
|
||||||
|
tests_require=['pytest']
|
||||||
)
|
)
|
||||||
|
63
timmy/tests/test_conf.py
Normal file
63
timmy/tests/test_conf.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env python2
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2015 Mirantis, 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 unittest
|
||||||
|
from timmy import conf
|
||||||
|
|
||||||
|
|
||||||
|
class ConfTest(unittest.TestCase):
|
||||||
|
def test_param_presence_and_types(self):
|
||||||
|
param_types = {
|
||||||
|
'hard_filter': dict,
|
||||||
|
'soft_filter': dict,
|
||||||
|
'ssh_opts': list,
|
||||||
|
'env_vars': list,
|
||||||
|
'timeout': int,
|
||||||
|
'prefix': str,
|
||||||
|
'rqdir': str,
|
||||||
|
'rqfile': list,
|
||||||
|
'compress_timeout': int,
|
||||||
|
'outdir': str,
|
||||||
|
'archive_dir': str,
|
||||||
|
'archive_name': str,
|
||||||
|
'outputs_timestamp': bool,
|
||||||
|
'dir_timestamp': bool,
|
||||||
|
'put': list,
|
||||||
|
'cmds': list,
|
||||||
|
'scripts': list,
|
||||||
|
'files': list,
|
||||||
|
'filelists': list,
|
||||||
|
'logs': list,
|
||||||
|
'logs_no_default': bool,
|
||||||
|
'logs_exclude_filtered': bool,
|
||||||
|
'logs_days': int,
|
||||||
|
'logs_speed_limit': bool,
|
||||||
|
'logs_speed_default': int,
|
||||||
|
'logs_speed': int,
|
||||||
|
'logs_size_coefficient': float,
|
||||||
|
'shell_mode': bool,
|
||||||
|
'do_print_results': bool,
|
||||||
|
'clean': bool
|
||||||
|
}
|
||||||
|
config = conf.load_conf(None)
|
||||||
|
for key in param_types:
|
||||||
|
self.assertEqual(type(config[key]), param_types[key])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
4
tox.ini
4
tox.ini
@ -9,9 +9,7 @@ install_command = pip install {opts} {packages}
|
|||||||
setenv =
|
setenv =
|
||||||
VIRTUAL_ENV={envdir}
|
VIRTUAL_ENV={envdir}
|
||||||
deps = -r{toxinidir}/test-requirements.txt
|
deps = -r{toxinidir}/test-requirements.txt
|
||||||
#commands = python setup.py test --slowest --testr-args='{posargs}'
|
commands = python setup.py test
|
||||||
# For now:
|
|
||||||
commands = true
|
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands = flake8 {posargs}
|
commands = flake8 {posargs}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user