Skip to content

Commit

Permalink
travis-tox-cov setup, first try
Browse files Browse the repository at this point in the history
  • Loading branch information
andhus committed Feb 17, 2019
1 parent 9ed3b16 commit 9702bf9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 10 deletions.
22 changes: 13 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
language: python
dist: trusty
python:
- "2.7"
- "3.6"

install:
- pip install -e .
- pip install pytest-cov codecov
- pip freeze
- pip install tox codecov

matrix:
include:
- python: 2.7
env: TOXENV=py27
- python: 3.7
env: TOXENV=py37

script:
- py.test --cov-config=.coveragerc --cov=dirhash tests/
- tox -e TOXENV

after_success:
- coverage report
- codecov
- codecov -e TOXENV
11 changes: 10 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import print_function, division

import os
import sys
import shlex
import subprocess

Expand All @@ -9,14 +10,22 @@
import pytest


console_script = os.path.join(
os.path.dirname(sys.executable),
'dirhash'
)


def dirhash_run(argstring, add_env=None):
assert os.path.isfile(console_script)
assert os.access(console_script, os.X_OK)
if add_env:
env = os.environ.copy()
env.update(add_env)
else:
env = None
process = subprocess.Popen(
['dirhash'] + shlex.split(argstring),
[console_script] + shlex.split(argstring),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env
Expand Down
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tox]
envlist = py27,py37

[testenv]
deps =
pytest-cov
commands =
py.test --cov-report=xml --cov-config=.coveragerc --cov=dirhash tests/
coverage report

0 comments on commit 9702bf9

Please sign in to comment.