Skip to content

Commit 4f75623

Browse files
committed
Enable testing with travis-ci
- renamed strategies/branch/tests/test_core.py - pytest support in setup.py - travis badge in README.md
1 parent 799d7d0 commit 4f75623

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: python
2+
python:
3+
- 2.6
4+
- 2.7
5+
- 3.2
6+
- 3.3
7+
- 3.4
8+
- "pypy"
9+
- "pypy3"
10+
script:
11+
- python setup.py test
12+
notifications:
13+
email: false

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Strategies
22
==========
33

4+
[![](https://travis-ci.org/logpy/strategies.png)](https://travis-ci.org/logpy/strategies)
5+
46
A Python library for control flow programming.
57

68
This project contains a set of complementary higher order functions that

setup.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
from os.path import exists
1+
import os
2+
import sys
23
from setuptools import setup
4+
from setuptools.command.test import test as TestCommand
5+
6+
7+
class PyTest(TestCommand):
8+
def finalize_options(self):
9+
TestCommand.finalize_options(self)
10+
_test_args = [
11+
'--ignore=setup.py',
12+
'--verbose',
13+
'--durations=5',
14+
'--doctest-modules',
15+
]
16+
extra_args = os.environ.get('PYTEST_EXTRA_ARGS')
17+
if extra_args is not None:
18+
_test_args.extend(extra_args.split())
19+
self.test_args = _test_args
20+
self.test_suite = True
21+
22+
def run_tests(self):
23+
import pytest
24+
errno = pytest.main(self.test_args)
25+
sys.exit(errno)
326

427
setup(name='strategies',
528
version='0.2.0',
@@ -8,7 +31,9 @@
831
author='Matthew Rocklin',
932
author_email='mrocklin@gmail.com',
1033
install_requires=open('dependencies.txt').read().split('\n'),
34+
tests_require=['pytest'],
35+
cmdclass = {'test': PyTest},
1136
license='BSD',
1237
packages=['strategies', 'strategies.branch'],
13-
long_description=open('README.md').read() if exists("README.md") else "",
38+
long_description=open('README.md').read() if os.path.exists("README.md") else "",
1439
zip_safe=False)

0 commit comments

Comments
 (0)