Skip to content

Commit 9702bf9

Browse files
committed
travis-tox-cov setup, first try
1 parent 9ed3b16 commit 9702bf9

File tree

3 files changed

+32
-10
lines changed

3 files changed

+32
-10
lines changed

.travis.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
language: python
22
dist: trusty
3-
python:
4-
- "2.7"
5-
- "3.6"
3+
64
install:
7-
- pip install -e .
8-
- pip install pytest-cov codecov
9-
- pip freeze
5+
- pip install tox codecov
6+
7+
matrix:
8+
include:
9+
- python: 2.7
10+
env: TOXENV=py27
11+
- python: 3.7
12+
env: TOXENV=py37
13+
1014
script:
11-
- py.test --cov-config=.coveragerc --cov=dirhash tests/
15+
- tox -e TOXENV
16+
1217
after_success:
13-
- coverage report
14-
- codecov
18+
- codecov -e TOXENV

tests/test_cli.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import print_function, division
22

33
import os
4+
import sys
45
import shlex
56
import subprocess
67

@@ -9,14 +10,22 @@
910
import pytest
1011

1112

13+
console_script = os.path.join(
14+
os.path.dirname(sys.executable),
15+
'dirhash'
16+
)
17+
18+
1219
def dirhash_run(argstring, add_env=None):
20+
assert os.path.isfile(console_script)
21+
assert os.access(console_script, os.X_OK)
1322
if add_env:
1423
env = os.environ.copy()
1524
env.update(add_env)
1625
else:
1726
env = None
1827
process = subprocess.Popen(
19-
['dirhash'] + shlex.split(argstring),
28+
[console_script] + shlex.split(argstring),
2029
stdout=subprocess.PIPE,
2130
stderr=subprocess.PIPE,
2231
env=env

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tox]
2+
envlist = py27,py37
3+
4+
[testenv]
5+
deps =
6+
pytest-cov
7+
commands =
8+
py.test --cov-report=xml --cov-config=.coveragerc --cov=dirhash tests/
9+
coverage report

0 commit comments

Comments
 (0)