Commit 365faee8 authored by Matthew Pounsett's avatar Matthew Pounsett

setting up basic test framework

parent 3f0b54ba
......@@ -2,3 +2,37 @@
This library implements the RNDC protocol natively in Python, to allow direct
control of BIND instances from within your Python programs.
## Testing
You will need (at least) python 2.7, 3.4, 3.5, and 3.6. The easiest way to
get these all installed is with [pyenv](https://www.holger-peters.de/using-pyenv-and-tox.html).
As of last update, the current versions are:
```
pyenv install 2.7.15
pyenv install 3.4.8
pyenv install 3.5.5
pyenv install 3.6.5
pyenv global system 3.6.5 3.5.5 3.4.8 2.7.15
```
Before running tests you will require some python packages to be installed.
```
pip install -r requirements_test.txt
```
To run all tests:
```
tox
```
As of last update there are no code tests implemented, and there are a
significant number of lint test failures. These will need to be added and
cleaned up, respectively.
Current test coverage can be seen by loading `htmlcov/index.html` after
running all tests.
[BASIC]
include-naming-hint=yes
coverage==4.3.4
flake8==3.3
pylint==1.6.5
pydocstyle==1.1.1
tox==2.6.0
......@@ -3,10 +3,10 @@ Python RNDC protocol library
A native python library that implements the RNDC protocol.
"""
from setuptools import setup
from codecs import open
from os import path
from setuptools import setup
from unittest import TestLoader
from rndc import __version__
......@@ -15,6 +15,13 @@ here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def get_test_suite():
test_loader = TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
return test_suite
setup(
name="rndc",
version=__version__,
......@@ -41,6 +48,7 @@ setup(
'License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)',
],
test_suite='setup.get_test_suite',
py_modules=['rndc'],
install_requires=[],
......
# -*- coding: utf-8 -*-
############################################################################
# Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# See the COPYRIGHT file distributed with this work for additional
# information regarding copyright ownership.
############################################################################
import os
import sys
import unittest
sys.path.insert(0,
os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
)
import rndc
# A simple sample test that doesn't do anything useful, yet.
class TestImportRNDC(unittest.TestCase):
def test_import_rndc(self):
self.assertEqual(1, 1)
[tox]
envlist = clean, lint, py27, py34, py35, py36, stats
skip_missing_interpreters = False
[testenv]
commands =
coverage run --source=rndc -a setup.py test
deps = coverage
[testenv:lint]
basepython = python3
ignore_errors = True
deps =
-r{toxinidir}/requirements_test.txt
commands =
flake8
pylint rndc
pydocstyle rndc tests
[testenv:clean]
commands =
coverage erase
[testenv:stats]
commands =
coverage report
coverage html
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment