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
pull/27/head
Daniel Lintott 10 years ago
parent a4bc96af28
commit 4a33b2021c

@ -1,15 +1,19 @@
language: python language: python
env:
- TOX_ENV=py33
- TOX_ENV=py34
before_install: before_install:
- "sudo add-apt-repository ppa:gns3/ppa -y" - sudo add-apt-repository ppa:gns3/ppa -y
- "sudo apt-get update -q" - sudo apt-get update -q
install: install:
- "pip install -r requirements.txt --use-mirrors" - pip install tox
- "pip install tox" - sudo apt-get install vpcs dynamips
- "sudo apt-get install vpcs dynamips"
script: "python setup.py test" script:
- tox -e $TOX_ENV
branches: branches:
only: only:

@ -20,7 +20,7 @@ from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand from setuptools.command.test import test as TestCommand
class Tox(TestCommand): class PyTest(TestCommand):
def finalize_options(self): def finalize_options(self):
TestCommand.finalize_options(self) TestCommand.finalize_options(self)
@ -29,8 +29,9 @@ class Tox(TestCommand):
def run_tests(self): def run_tests(self):
#import here, cause outside the eggs aren't loaded #import here, cause outside the eggs aren't loaded
import tox import pytest
errcode = tox.cmdline(self.test_args) #errcode = tox.cmdline(self.test_args)
errcode = pytest.main(self.test_args)
sys.exit(errcode) sys.exit(errcode)
setup( setup(
@ -38,8 +39,8 @@ setup(
version=__import__("gns3server").__version__, version=__import__("gns3server").__version__,
url="http://github.com/GNS3/gns3-server", url="http://github.com/GNS3/gns3-server",
license="GNU General Public License v3 (GPLv3)", license="GNU General Public License v3 (GPLv3)",
tests_require=["tox"], tests_require=["pytest"],
cmdclass={"test": Tox}, cmdclass={"test": PyTest},
author="Jeremy Grossmann", author="Jeremy Grossmann",
author_email="package-maintainer@gns3.net", author_email="package-maintainer@gns3.net",
description="GNS3 server to asynchronously manage emulators", description="GNS3 server to asynchronously manage emulators",

@ -2,6 +2,6 @@
envlist = py33, py34 envlist = py33, py34
[testenv] [testenv]
commands = py.test [] -s tests commands = python setup.py test
deps = -rdev-requirements.txt deps = -rdev-requirements.txt

Loading…
Cancel
Save