summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeif Madsen <lmadsen@redhat.com>2016-10-28 05:59:53 -0400
committerzshi <zshi@redhat.com>2016-12-13 12:48:12 +0800
commitef7fd4008481b5b98316240b0703d2c78fbd30e8 (patch)
tree54a49e56fbdacfb9eac3a6015629f58c2bbed16a
parenta372d5dff98c600f0318ac8e60e7db37cd47aaa8 (diff)
[WIP] Migrate to tox based environment
Migrate the custom setup.py to a more formal setup environment using tox, in the same way that OpenStack configures their projects. Adds metadata to tox.ini from the setup.py file, and breaks out the dependencies from setup.py into requirements.txt and test-requirements.txt. Executes flake8 testing for pep8 coverage. Defaults to using Python 2 for the environment. Change-Id: Ieaea7d9f3dc227febd8fb1dc9142d478ba197a92 Signed-off-by: Leif Madsen <lmadsen@redhat.com> Signed-off-by: zshi <zshi@redhat.com>
-rw-r--r--.gitignore2
-rw-r--r--docs/dovetailtool/index.rst2
-rw-r--r--docs/plugfest/2016.05/test_plan/application/testcases.rst5
-rw-r--r--docs/plugfest/2016.05/test_plan/index.rst1
-rw-r--r--docs/plugfest/2016.05/test_plan/integration/testcases.rst5
-rw-r--r--docs/testsuites/ipv6/index.rst4
-rw-r--r--docs/userguide/02-certification_criteria.rst3
-rw-r--r--docs/userguide/03-certification_progress.rst3
-rw-r--r--dovetail/container.py2
-rw-r--r--dovetail/parser.py2
-rw-r--r--dovetail/report.py28
-rw-r--r--dovetail/testcase.py6
-rw-r--r--requirements.txt6
-rw-r--r--setup.cfg7
-rw-r--r--setup.py32
-rw-r--r--test-requirements.txt6
-rw-r--r--tox.ini26
17 files changed, 83 insertions, 57 deletions
diff --git a/.gitignore b/.gitignore
index 913e3713..cae3e659 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,7 @@
# Packages
*.egg
-*.egg-info
+.testrepository
dist
build
eggs
diff --git a/docs/dovetailtool/index.rst b/docs/dovetailtool/index.rst
index a025cd50..592fa564 100644
--- a/docs/dovetailtool/index.rst
+++ b/docs/dovetailtool/index.rst
@@ -12,5 +12,5 @@ Dovetail Overview
dovetail.tool.overview.rst
dovetail.tool.installation.rst
- dovetail.tool.configuation.rst
+ dovetail.tool.configuration.rst
dovetail.tool.configtemplate.rst
diff --git a/docs/plugfest/2016.05/test_plan/application/testcases.rst b/docs/plugfest/2016.05/test_plan/application/testcases.rst
index 0e49c5c8..bb1bba76 100644
--- a/docs/plugfest/2016.05/test_plan/application/testcases.rst
+++ b/docs/plugfest/2016.05/test_plan/application/testcases.rst
@@ -16,8 +16,3 @@ files in this directory that are imported below the toctree command below.
.. toctree::
:maxdepth: 2
-
- ./testcase1.rst
- ./testcase2.rst
- ./testcase_etc.rst
-
diff --git a/docs/plugfest/2016.05/test_plan/index.rst b/docs/plugfest/2016.05/test_plan/index.rst
index 61de3bd5..e4bf5e91 100644
--- a/docs/plugfest/2016.05/test_plan/index.rst
+++ b/docs/plugfest/2016.05/test_plan/index.rst
@@ -16,4 +16,5 @@ OPNFV Plugfest - test plan
./deployment/testcases.rst
./integration/testcases.rst
./application/testcases.rst
+ ./templates/template.rst
diff --git a/docs/plugfest/2016.05/test_plan/integration/testcases.rst b/docs/plugfest/2016.05/test_plan/integration/testcases.rst
index d0f01156..c7211f96 100644
--- a/docs/plugfest/2016.05/test_plan/integration/testcases.rst
+++ b/docs/plugfest/2016.05/test_plan/integration/testcases.rst
@@ -18,8 +18,3 @@ files in this directory that are imported below the toctree command below.
.. toctree::
:maxdepth: 2
-
- ./testcase1.rst
- ./testcase2.rst
- ./testcase_etc.rst
-
diff --git a/docs/testsuites/ipv6/index.rst b/docs/testsuites/ipv6/index.rst
index 72fd6a89..a806d644 100644
--- a/docs/testsuites/ipv6/index.rst
+++ b/docs/testsuites/ipv6/index.rst
@@ -10,6 +10,10 @@ OPNFV IPv6 Compliance Test Plan
:maxdepth: 2
./testplan.rst
+ ./testprocedure.rst
+ ./testspecification.rst
+ ./designspecification.rst
./ipv6.tc001.specification.rst
./ipv6.tc026.specification.rst
+ ./ipv6_all_testcases.rst
diff --git a/docs/userguide/02-certification_criteria.rst b/docs/userguide/02-certification_criteria.rst
index e69de29b..7665f9a0 100644
--- a/docs/userguide/02-certification_criteria.rst
+++ b/docs/userguide/02-certification_criteria.rst
@@ -0,0 +1,3 @@
+==================
+Dovetail Criteria
+==================
diff --git a/docs/userguide/03-certification_progress.rst b/docs/userguide/03-certification_progress.rst
index e69de29b..6ee02012 100644
--- a/docs/userguide/03-certification_progress.rst
+++ b/docs/userguide/03-certification_progress.rst
@@ -0,0 +1,3 @@
+==================
+Dovetail Progress
+==================
diff --git a/dovetail/container.py b/dovetail/container.py
index a0cdf657..67a70767 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -28,7 +28,7 @@ class Container:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.Container').getLogger()
+ cls.logger = dt_logger.Logger(__name__ + '.Container').getLogger()
@classmethod
def get(cls, type):
diff --git a/dovetail/parser.py b/dovetail/parser.py
index d8f9fa0a..4385325d 100644
--- a/dovetail/parser.py
+++ b/dovetail/parser.py
@@ -22,7 +22,7 @@ class Parser:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.Parser').getLogger()
+ cls.logger = dt_logger.Logger(__name__ + '.Parser').getLogger()
@classmethod
def parse_cmd(cls, cmd, testcase):
diff --git a/dovetail/report.py b/dovetail/report.py
index 7fd4076d..a6fff20c 100644
--- a/dovetail/report.py
+++ b/dovetail/report.py
@@ -36,7 +36,7 @@ class Report:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.Report').getLogger()
+ cls.logger = dt_logger.Logger(__name__ + '.Report').getLogger()
@staticmethod
def check_result(testcase, db_result):
@@ -126,22 +126,22 @@ class Report:
pass_num += 1
if total_num != 0:
- pass_rate = pass_num/total_num
+ pass_rate = pass_num / total_num
report_txt += 'Pass Rate: %.2f%% (%s/%s)\n' %\
- (pass_rate*100, pass_num, total_num)
+ (pass_rate * 100, pass_num, total_num)
report_txt += 'Assessed test areas:\n'
for key in sub_report:
if testcase_num[key] != 0:
- pass_rate = testcase_passnum[key]/testcase_num[key]
+ pass_rate = testcase_passnum[key] / testcase_num[key]
# TO DO: once version scheme settled, adjust accordingly
doc_link = dt_cfg.dovetail_config['repo'] +\
('docs/testsuites/%s' % key)
report_txt += '- %s results: <%s> pass %.2f%%\n' %\
- (key, doc_link, pass_rate*100)
+ (key, doc_link, pass_rate * 100)
for key in sub_report:
if testcase_num[key] != 0:
- pass_rate = testcase_passnum[key]/testcase_num[key]
- report_txt += '%s: pass rate %.2f%%\n' % (key, pass_rate*100)
+ pass_rate = testcase_passnum[key] / testcase_num[key]
+ report_txt += '%s: pass rate %.2f%%\n' % (key, pass_rate * 100)
report_txt += sub_report[key]
cls.logger.info(report_txt)
@@ -205,7 +205,8 @@ class FunctestCrawler:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.FunctestCrawler').getLogger()
+ cls.logger = \
+ dt_logger.Logger(__name__ + '.FunctestCrawler').getLogger()
def crawl(self, testcase=None):
store_type = \
@@ -273,7 +274,8 @@ class YardstickCrawler:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.YardstickCrawler').getLogger()
+ cls.logger = \
+ dt_logger.Logger(__name__ + '.YardstickCrawler').getLogger()
def crawl(self, testcase=None):
store_type = \
@@ -286,7 +288,7 @@ class YardstickCrawler:
def crawl_from_file(self, testcase=None):
file_path = os.path.join(dt_cfg.dovetail_config['result_dir'],
- testcase+'.out')
+ testcase + '.out')
if not os.path.exists(file_path):
self.logger.info('result file not found: %s' % file_path)
return None
@@ -332,7 +334,8 @@ class FunctestChecker:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.FunctestChecker').getLogger()
+ cls.logger = \
+ dt_logger.Logger(__name__ + '.FunctestChecker').getLogger()
def check(self, testcase, db_result):
sub_testcase_list = testcase.sub_testcase()
@@ -371,7 +374,8 @@ class YardstickChecker:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.YardstickChecker').getLogger()
+ cls.logger = \
+ dt_logger.Logger(__name__ + '.YardstickChecker').getLogger()
@staticmethod
def check(testcase, result):
diff --git a/dovetail/testcase.py b/dovetail/testcase.py
index 60ce2b28..9cd8e777 100644
--- a/dovetail/testcase.py
+++ b/dovetail/testcase.py
@@ -30,7 +30,7 @@ class Testcase:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.Testcase').getLogger()
+ cls.logger = dt_logger.Logger(__name__ + '.Testcase').getLogger()
def prepare_cmd(self):
script_type = self.script_type()
@@ -56,7 +56,7 @@ class Testcase:
def sub_testcase_passed(self, name, passed=None):
if passed is not None:
- self.logger.debug('sub_testcase_passed:%s %s' % (name, passed))
+ self.logger.debug('sub_testcase_passed:%s %s' % (name, passed))
self.sub_testcase_status[name] = passed
return self.sub_testcase_status[name]
@@ -169,7 +169,7 @@ class Testsuite:
@classmethod
def create_log(cls):
- cls.logger = dt_logger.Logger(__name__+'.Testsuite').getLogger()
+ cls.logger = dt_logger.Logger(__name__ + '.Testsuite').getLogger()
def get_test(self, testcase_name):
if testcase_name in self.testcase_list:
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..a176ad61
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,6 @@
+pbr>=1.6
+coverage>=3.6
+flake8<3.0
+Jinja2>=2.6
+PyYAML>=3.10
+Click
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 00000000..c691f066
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,7 @@
+[metadata]
+name = dovetail
+home-page = https://wiki.opnfv.org/display/dovetail
+
+[entry_points]
+console_scripts =
+ dovetail = dovetail.main:main
diff --git a/setup.py b/setup.py
index 40dc4751..b9f6e141 100644
--- a/setup.py
+++ b/setup.py
@@ -7,32 +7,8 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-from setuptools import setup, find_packages
+import setuptools
-
-setup(
- name="dovetail",
- version="0.dev0",
- packages=find_packages(),
- include_package_data=True,
- package_data={
- 'dovetail': [
- '*.py',
- 'conf/*.py',
- 'conf/*.yml',
- 'utils/*.py',
- ]
- },
- url="https://www.opnfv.org",
- install_requires=["coverage>=3.6",
- "flake8",
- "Jinja2>=2.6",
- "PyYAML>=3.10",
- "Click"
- ],
- entry_points={
- 'console_scripts': [
- 'dovetail=dovetail.main:main',
- ],
- }
-)
+setuptools.setup(
+ setup_requires=['pbr>=1.8'],
+ pbr=True)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 00000000..8ea9c2b6
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,6 @@
+pytest
+pykwalify
+mock
+testrepository
+testscenarios
+testtools
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 00000000..12cf8e32
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,26 @@
+[tox]
+minversion = 1.6
+skipsdist = True
+envlist = py27,pep8
+
+[testenv]
+basepython=python2
+usedevelop = True
+install_command = pip install -U {opts} {packages}
+deps = -r{toxinidir}/requirements.txt
+ -r{toxinidir}/test-requirements.txt
+commands =
+ py.test --basetemp={envtmpdir} {posargs}
+setenv =
+ VIRTUAL_ENV={envdir}
+ HOME = {envtmpdir}
+ PYTHONPATH = {toxinidir}
+
+[testenv:pep8]
+deps = flake8
+commands = flake8 {toxinidir}
+
+[flake8]
+show-source = True
+ignore = E123,E125,H803
+exclude = .tox,dist,docs,.egg,build,.venv,.git