From 4a33b2021ca61644981009a127ccb567c36bf193 Mon Sep 17 00:00:00 2001 From: Daniel Lintott Date: Sat, 9 Aug 2014 12:05:31 +0100 Subject: [PATCH] Further optimise the Travis testing and improve running tests for a user + Convert setup.py test to run py.test instead of tox + Tox should now run setup.py test + TravisCI will create a job for each TOX_ENV and then execute tox to run the tests for that TOX_ENV --- .travis.yml | 16 ++++++++++------ setup.py | 11 ++++++----- tox.ini | 2 +- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3a03c5fb..883004a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,19 @@ language: python +env: + - TOX_ENV=py33 + - TOX_ENV=py34 + before_install: - - "sudo add-apt-repository ppa:gns3/ppa -y" - - "sudo apt-get update -q" + - sudo add-apt-repository ppa:gns3/ppa -y + - sudo apt-get update -q install: - - "pip install -r requirements.txt --use-mirrors" - - "pip install tox" - - "sudo apt-get install vpcs dynamips" + - pip install tox + - sudo apt-get install vpcs dynamips -script: "python setup.py test" +script: + - tox -e $TOX_ENV branches: only: diff --git a/setup.py b/setup.py index e64cfa3d..7e437d4d 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand -class Tox(TestCommand): +class PyTest(TestCommand): def finalize_options(self): TestCommand.finalize_options(self) @@ -29,8 +29,9 @@ class Tox(TestCommand): def run_tests(self): #import here, cause outside the eggs aren't loaded - import tox - errcode = tox.cmdline(self.test_args) + import pytest + #errcode = tox.cmdline(self.test_args) + errcode = pytest.main(self.test_args) sys.exit(errcode) setup( @@ -38,8 +39,8 @@ setup( version=__import__("gns3server").__version__, url="http://github.com/GNS3/gns3-server", license="GNU General Public License v3 (GPLv3)", - tests_require=["tox"], - cmdclass={"test": Tox}, + tests_require=["pytest"], + cmdclass={"test": PyTest}, author="Jeremy Grossmann", author_email="package-maintainer@gns3.net", description="GNS3 server to asynchronously manage emulators", diff --git a/tox.ini b/tox.ini index b10796da..200e7ce4 100644 --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,6 @@ envlist = py33, py34 [testenv] -commands = py.test [] -s tests +commands = python setup.py test deps = -rdev-requirements.txt