Skip to content

Commit

Permalink
Merge pull request #2 from andhus/add_tox
Browse files Browse the repository at this point in the history
Use tox for CI
  • Loading branch information
andhus authored Feb 17, 2019
2 parents c42a0ff + f912f2e commit c3362a7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 12 deletions.
27 changes: 18 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
language: python
dist: trusty
python:
- "2.7"
- "3.6"
dist: xenial

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

after_success:
- coverage report
- codecov

notifications:
email:
on_success: never
on_failure: always
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import io
import os
from setuptools import setup
from setuptools import setup, find_packages

VERSION = '0.1.1'

Expand All @@ -27,7 +27,8 @@
'pathspec>=0.5.9',
'scandir>=1.9.0;python_version<"3.5"'
],
packages=['dirhash'],
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
entry_points={
'console_scripts': ['dirhash=dirhash.cli:main'],
Expand Down
File renamed without changes.
File renamed without changes.
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 c3362a7

Please sign in to comment.