Skip to content

Commit 6f15836

Browse files
committed
Merge pull request #5 from robdennis/master
adding tox / travis / coverage support; fixing python 2.6 test bug
2 parents 18e2bfb + d356e76 commit 6f15836

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
branch = True

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: python
2+
python: 2.7
3+
env:
4+
- TOX_ENV=py34
5+
- TOX_ENV=py33
6+
- TOX_ENV=py32
7+
- TOX_ENV=py27
8+
- TOX_ENV=py26
9+
install:
10+
- pip install tox
11+
- pip install python-coveralls
12+
script:
13+
- tox -e $TOX_ENV
14+
after_success:
15+
coveralls

tests/test_ordering.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def get_module(module_name):
14-
return __import__(module_name, globals(), locals(), [], -1)
14+
return __import__(module_name, globals(), locals(), [], 1)
1515

1616

1717
def get_tests(module_name):
@@ -20,7 +20,7 @@ def get_tests(module_name):
2020

2121

2222
def _names_of_tests(output, test_file_name):
23-
regex = r'^{}:(\d+): test_([a-z]) PASSED$'.format(
23+
regex = r'^{0}:(\d+): test_([a-z]) PASSED$'.format(
2424
test_file_name.replace('.', '\.'))
2525
for line in output.split('\n'):
2626
match = re.match(regex, line)
@@ -40,7 +40,7 @@ def get_order(output, test_file_name):
4040
])
4141
def test_ordering(module_name, capsys):
4242
module = get_module(module_name)
43-
pytest.main('{}/{}.py -vv'.format(__here__, module_name))
44-
relative_filename = 'tests/{}.py'.format(module_name)
43+
pytest.main('{0}/{1}.py -vv'.format(__here__, module_name))
44+
relative_filename = 'tests/{0}.py'.format(module_name)
4545
out, err = capsys.readouterr()
4646
assert list(module.ordering) == get_order(out, relative_filename)

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# content of: tox.ini, put in same dir as setup.py
2+
[tox]
3+
envlist = py26,py27,py32,py33,pypy
4+
[testenv]
5+
deps=pytest
6+
pytest-cov
7+
commands=coverage run --source=pytest_ordering.py -m py.test tests
8+
coverage report

0 commit comments

Comments
 (0)