From 9ed3b16ad1fec25db2d1923984567b404e9a7384 Mon Sep 17 00:00:00 2001 From: Anders Huss Date: Sat, 16 Feb 2019 07:18:40 +0100 Subject: [PATCH 1/3] change package layout to use src (as per Hynek S, Ional C arguments) --- setup.py | 5 +++-- {dirhash => src/dirhash}/__init__.py | 0 {dirhash => src/dirhash}/cli.py | 0 3 files changed, 3 insertions(+), 2 deletions(-) rename {dirhash => src/dirhash}/__init__.py (100%) rename {dirhash => src/dirhash}/cli.py (100%) 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 From 9702bf91b6a9d8e628fd79e63c67b3ff2c41cc87 Mon Sep 17 00:00:00 2001 From: Anders Huss Date: Sun, 17 Feb 2019 04:22:39 +0100 Subject: [PATCH 2/3] travis-tox-cov setup, first try --- .travis.yml | 22 +++++++++++++--------- tests/test_cli.py | 11 ++++++++++- tox.ini | 9 +++++++++ 3 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 tox.ini diff --git a/.travis.yml b/.travis.yml index 17a0f3f..546b127 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 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 From f912f2e6f4f88f104af86bd18b73b303d0662ad8 Mon Sep 17 00:00:00 2001 From: Anders Huss Date: Sun, 17 Feb 2019 04:38:54 +0100 Subject: [PATCH 3/3] change to xenial dist for py37, remove unnecessary env flag for tox and codecov, disable notifications when ok --- .travis.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 546b127..82dceb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: python -dist: trusty +dist: xenial install: - pip install tox codecov @@ -12,7 +12,12 @@ matrix: env: TOXENV=py37 script: - - tox -e TOXENV + - tox after_success: - - codecov -e TOXENV + - codecov + +notifications: + email: + on_success: never + on_failure: always