Skip to content

Commit c3362a7

Browse files
authored
Merge pull request #2 from andhus/add_tox
Use tox for CI
2 parents c42a0ff + f912f2e commit c3362a7

File tree

6 files changed

+40
-12
lines changed

6 files changed

+40
-12
lines changed

.travis.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
language: python
2-
dist: trusty
3-
python:
4-
- "2.7"
5-
- "3.6"
2+
dist: xenial
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
16+
1217
after_success:
13-
- coverage report
1418
- codecov
19+
20+
notifications:
21+
email:
22+
on_success: never
23+
on_failure: always

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import io
22
import os
3-
from setuptools import setup
3+
from setuptools import setup, find_packages
44

55
VERSION = '0.1.1'
66

@@ -27,7 +27,8 @@
2727
'pathspec>=0.5.9',
2828
'scandir>=1.9.0;python_version<"3.5"'
2929
],
30-
packages=['dirhash'],
30+
packages=find_packages('src'),
31+
package_dir={'': 'src'},
3132
include_package_data=True,
3233
entry_points={
3334
'console_scripts': ['dirhash=dirhash.cli:main'],
File renamed without changes.

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)