Check for missing run-time requirements
This change creates a new tox environment that *only* installs openstack_requirements and then verifies that each of the console scripts has all of the modules that it imports. This will need to be added to our gate RSN Change-Id: Ibc37593afcc4d9f820cb88168e1aa15e773b2087
This commit is contained in:
parent
f93f34278a
commit
9a428f3ddb
29
tools/check-install.py
Normal file
29
tools/check-install.py
Normal file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import ConfigParser
|
||||
import importlib
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
errors = 0
|
||||
pattern = re.compile('^(.*?)\s*=\s*([^:]*?):.*$')
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read('setup.cfg')
|
||||
console_scripts = config.get('entry_points', 'console_scripts')
|
||||
for script in console_scripts.split('\n'):
|
||||
match = pattern.match(script)
|
||||
if match:
|
||||
(script, module) = match.groups()
|
||||
try:
|
||||
importlib.import_module(module)
|
||||
except ImportError as err:
|
||||
print('Imports for %s failed:\n\t%s' % (script, err))
|
||||
errors += 1
|
||||
return 1 if errors else 0
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
15
tox.ini
15
tox.ini
@ -1,9 +1,10 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
skipsdist = True
|
||||
envlist = validate,py27,pep8
|
||||
envlist = validate,py27,pep8,pip-install
|
||||
|
||||
[testenv]
|
||||
basepython = python2.7
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv = VIRTUAL_ENV={envdir}
|
||||
@ -36,6 +37,18 @@ commands = flake8
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:pip-install]
|
||||
recreate = True
|
||||
deps = .
|
||||
install_command = pip install {opts} {packages}
|
||||
commands = python {toxinidir}/tools/check-install.py
|
||||
|
||||
[testenv:py34]
|
||||
basepython = python3.4
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
|
||||
[testenv:babel]
|
||||
# Use the local upper-constraints.txt file
|
||||
deps = Babel
|
||||
|
Loading…
Reference in New Issue
Block a user