add setup tests

This commit is contained in:
Luke Campagnola 2014-03-24 22:24:27 -04:00
parent 9291db64f2
commit 5d2441a29b
2 changed files with 27 additions and 3 deletions

View File

@ -81,17 +81,21 @@ install:
- python${PYTHON} --version - python${PYTHON} --version
- apt-cache search python3-pyqt - apt-cache search python3-pyqt
- apt-cache search python3-pyside - apt-cache search python3-pyside
before_script: before_script:
# We need to create a (fake) display on Travis, let's use a funny resolution # We need to create a (fake) display on Travis, let's use a funny resolution
- export DISPLAY=:99.0 - export DISPLAY=:99.0
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1400x900x24 -ac +extension GLX +render
# Make sure everyone uses the correct python
- mkdir ~/bin && ln -s `which python${PYTHON}` ~/bin
- export PATH=~/bin:$PATH
script: script:
# Run unit tests # Run unit tests
- python${PYTHON} setup.py test - python setup.py test
# check line endings # check line endings
- if [ "${TEST}" == "extra" ]; then - if [ "${TEST}" == "extra" ]; then
@ -104,7 +108,13 @@ script:
# Check for style issues # Check for style issues
- if [ "${TEST}" == "extra" ]; then - if [ "${TEST}" == "extra" ]; then
python${PYTHON} setup.py style; python setup.py style;
fi; fi;
# Check install works
- CWD=`pwd`
- python setup.py install && cd .. && echo "import pyqtgraph.examples" | python
# Check double-install fails
- cd pyqtgraph && python setup.py install && if [ $? == 0 ]; then false; fi;

View File

@ -93,11 +93,25 @@ class Build(distutils.command.build.build):
sys.excepthook(*sys.exc_info()) sys.excepthook(*sys.exc_info())
return ret return ret
import distutils.command.install
class Install(distutils.command.install.install):
"""
* Check for previously-installed version before installing
"""
def run(self):
name = self.config_vars['dist_name']
if name in os.listdir(self.install_libbase):
raise Exception("It appears another version of %s is already "
"installed at %s; remove this before installing."
% (name, self.install_libbase))
print("Installing to %s" % self.install_libbase)
return distutils.command.install.install.run(self)
setup( setup(
version=version, version=version,
cmdclass={'build': Build, cmdclass={'build': Build,
'install': Install,
'deb': helpers.DebCommand, 'deb': helpers.DebCommand,
'test': helpers.TestCommand, 'test': helpers.TestCommand,
'debug': helpers.DebugCommand, 'debug': helpers.DebugCommand,