Permalink
Browse files

Add tox and travis.ci support

  • Loading branch information...
jpscaletti committed Feb 10, 2013
1 parent f73d92c commit c189ebbe1e61ccc123142a4988488c1c1b868037
Showing with 31 additions and 6 deletions.
  1. +1 −1 .coveragerc
  2. +2 −0 .gitignore
  3. +8 −0 .travis.yml
  4. +15 −5 setup.py
  5. +5 −0 tox.ini
View
@@ -1,2 +1,2 @@
[run]
-omit = tests/*
+omit = tests/*, setup.py
View
@@ -7,4 +7,6 @@ dist
.coverage
.coveragerc
+.tox
+htmlcov
__pycache__
View
@@ -0,0 +1,8 @@
+language: python
+python:
+ - "2.7"
+ - "pypy"
+# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
+install: pip install -r requirements.txt --use-mirrors
+# command to run tests, e.g. python setup.py test
+script: python setup.py test
View
@@ -3,6 +3,8 @@
import os
import re
from setuptools import setup
+from setuptools.command.test import test as TestCommand
+import sys
PACKAGE = 'clay'
@@ -56,10 +58,17 @@ def get_requirements():
return [l for l in lines if l and not l.startswith('#')]
-def run_tests():
- import sys, subprocess
- errno = subprocess.call([sys.executable, 'runtests.py'])
- raise SystemExit(errno)
+class PyTest(TestCommand):
+
+ def finalize_options(self):
+ TestCommand.finalize_options(self)
+ self.test_args = ['tests']
+ self.test_suite = True
+
+ def run_tests(self):
+ import pytest
+ errno = pytest.main(self.test_args)
+ sys.exit(errno)
setup(
@@ -85,6 +94,7 @@ def run_tests():
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules'
],
- test_suite = '__main__.runtests',
+ tests_require = ['pytest'],
+ cmdclass = {'test': PyTest},
entry_points = {'console_scripts': ['clay = clay.manage:main']},
)
View
@@ -0,0 +1,5 @@
+[tox]
+envlist = py27,pypy
+[testenv]
+deps=pytest
+commands=py.test tests

0 comments on commit c189ebb

Please sign in to comment.