Fix the tox environment and requirements

Just get the basic gate working.

Change-Id: I7462e165707a5a2dfd68fc32c238ee968551d253
This commit is contained in:
Angus Salkeld 2014-12-03 13:12:04 +10:00
parent b30de4e5e9
commit f15de52075
7 changed files with 51 additions and 89 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
*~ *~
build build
dist dist
heat_cfnclient.egg-info *.egg-info
.venv .venv
AUTHORS AUTHORS
ChangeLog ChangeLog

View File

@ -13,34 +13,33 @@
# under the License. # under the License.
import testtools
import heat_cfnclient
import os import os
import subprocess import subprocess
import testtools
import heat_cfnclient
basepath = os.path.join(heat_cfnclient.__path__[0], os.path.pardir) basepath = os.path.join(heat_cfnclient.__path__[0], os.path.pardir)
@testtools.skip
class CliTest(testtools.TestCase): class CliTest(testtools.TestCase):
def test_heat_cfn(self): def test_heat_cfn(self):
self.bin_run('heat-cfn') self.bin_run('heat-cfn')
def test_heat_boto(self): def test_heat_boto(self):
self.bin_run('heat-boto') self.bin_run('heat-boto')
def test_heat_watch(self): def test_heat_watch(self):
self.bin_run('heat-watch') self.bin_run('heat-watch')
def bin_run(self, bin): def bin_run(self, bin):
fullpath = basepath + '/bin/' + bin fullpath = basepath + '/bin/' + bin
proc = subprocess.Popen(fullpath, proc = subprocess.Popen(fullpath,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
stdout, stderr = proc.communicate() stdout, stderr = proc.communicate()
if proc.returncode: if proc.returncode:
print('Error executing %s:\n %s %s ' % (bin, stdout, stderr)) print('Error executing %s:\n %s %s ' % (bin, stdout, stderr))
raise subprocess.CalledProcessError(proc.returncode, bin) raise subprocess.CalledProcessError(proc.returncode, bin)

View File

@ -1,13 +1,12 @@
d2to1>=0.2.10,<0.3 pbr>=0.6,!=0.7,<1.0
pbr>=0.5.10,<0.6
PyCrypto>=2.1.0 PyCrypto>=2.1.0
boto>=2.4.0 boto>=2.4.0
eventlet>=0.12.0 eventlet>=0.15.2
greenlet>=0.3.2 greenlet>=0.3.2
httplib2 httplib2>=0.7.5
iso8601>=0.1.4 iso8601>=0.1.9
argparse argparse
lxml>=2.3 lxml>=2.3
python-keystoneclient>=0.2.1 python-keystoneclient>=0.11.1
six six>=1.7.0
oslo.config>=1.1.0 oslo.config>=1.4.0 # Apache-2.0

View File

@ -14,8 +14,17 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
import setuptools import setuptools
# In python < 2.7.4, a lazy loading of package `pbr` will break
# setuptools if some other modules registered functions in `atexit`.
# solution from: http://bugs.python.org/issue15881#msg170215
try:
import multiprocessing # noqa
except ImportError:
pass
setuptools.setup( setuptools.setup(
setup_requires=['d2to1>=0.2.10,<0.3', 'pbr>=0.5.10,<0.6'], setup_requires=['pbr'],
d2to1=True) pbr=True)

View File

@ -1,11 +1,11 @@
# Install bounded pep8/pyflakes first, then let flake8 install # The order of packages is significant, because pip processes them in the order
pep8==1.4.5 # of appearance. Changing the order has an impact on the overall integration
pyflakes==0.7.2 # process, which may cause wedges in the gate later.
flake8==2.0
hacking>=0.5.3,<0.6
coverage # Hacking already pins down pep8, pyflakes and flake8
hacking>=0.8.0,<0.9
coverage>=3.6
discover discover
mox==0.5.3 mox>=0.5.3
testtools>=0.9.29 testrepository>=0.0.18
testrepository>=0.0.13 testtools>=0.9.36,!=1.2.0

View File

@ -1,50 +0,0 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Red Hat, 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 os
import sys
import install_venv_common as install_venv
def first_file(file_list):
for candidate in file_list:
if os.path.exists(candidate):
return candidate
def main(argv):
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
venv = os.environ['VIRTUAL_ENV']
pip_requires = first_file([
os.path.join(root, 'requirements.txt'),
os.path.join(root, 'tools', 'pip-requires'),
])
test_requires = first_file([
os.path.join(root, 'test-requirements.txt'),
os.path.join(root, 'tools', 'test-requires'),
])
py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
project = 'heat'
install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
py_version, project)
#NOTE(dprince): For Tox we only run post_process (which patches files, etc)
install.post_process()
if __name__ == '__main__':
main(sys.argv)

13
tox.ini
View File

@ -1,12 +1,18 @@
[tox] [tox]
envlist = py26,py27,pep8 envlist = py26,py27,pep8
minversion = 1.6
skipsdist = True
[testenv] [testenv]
# Note the hash seed is set to 0 until heat can be tested with a
# random hash seed successfully.
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
usedevelop = True
install_command = pip install {opts} {packages}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = commands =
python tools/patch_tox_venv.py
python setup.py testr --slowest --testr-args='{posargs}' python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8] [testenv:pep8]
@ -16,18 +22,17 @@ commands = flake8 heat_cfnclient bin/heat-cfn bin/heat-watch
commands = {posargs} commands = {posargs}
[testenv:cover] [testenv:cover]
setenv = VIRTUAL_ENV={envdir}
commands = commands =
python tools/patch_tox_venv.py
python setup.py testr --coverage python setup.py testr --coverage
[flake8] [flake8]
# F841 local variable 'json_template' is assigned to but never used # F841 local variable 'json_template' is assigned to but never used
# H201 no 'except:' at least use 'except Exception:' # H201 no 'except:' at least use 'except Exception:'
# H233 Python 3.x
# H302 import only modules.'bla..' does not import a module # H302 import only modules.'bla..' does not import a module
# H306 imports not in alphabetical order # H306 imports not in alphabetical order
# H404 multi line docstring should start with a summary # H404 multi line docstring should start with a summary
ignore = F841,H201,H302,H306,H404 ignore = F841,H201,H233,H302,H306,H404
show-source = true show-source = true
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build