diff --git a/tools/check-install.py b/tools/check-install.py new file mode 100644 index 0000000000..14fc45116b --- /dev/null +++ b/tools/check-install.py @@ -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()) diff --git a/tox.ini b/tox.ini index 4a57dd1723..46019e2378 100644 --- a/tox.ini +++ b/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