diff --git a/.travis.yml b/.travis.yml index 17a0f3f..82dceb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/setup.py b/setup.py index 1b344ed..05d7790 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import io import os -from setuptools import setup +from setuptools import setup, find_packages VERSION = '0.1.1' @@ -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'], diff --git a/dirhash/__init__.py b/src/dirhash/__init__.py similarity index 100% rename from dirhash/__init__.py rename to src/dirhash/__init__.py diff --git a/dirhash/cli.py b/src/dirhash/cli.py similarity index 100% rename from dirhash/cli.py rename to src/dirhash/cli.py diff --git a/tests/test_cli.py b/tests/test_cli.py index ce445f5..558f9cd 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,6 +1,7 @@ from __future__ import print_function, division import os +import sys import shlex import subprocess @@ -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 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..a819805 --- /dev/null +++ b/tox.ini @@ -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