diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..95332b4d --- /dev/null +++ b/.coveragerc @@ -0,0 +1,3 @@ +[report] +exclude_lines = + pragma: no cover ${COVERAGE_PYTHON_VERSION} diff --git a/.travis.yml b/.travis.yml index c14b697a..43de4ee5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,4 +6,9 @@ python: install: - python setup.py develop - pip install -r requirements.txt -script: py.test -v + - pip install coveralls +script: + - export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1} + - coverage run --source=thefuck,tests -m py.test -v +after_success: + coveralls diff --git a/thefuck/main.py b/thefuck/main.py index 8d1a3dac..1e91017d 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -11,7 +11,7 @@ import six from . import logs, conf, types, shells -def setup_user_dir(): +def setup_user_dir(): # pragma: no cover """Returns user config dir, create it when it doesn't exist.""" user_dir = Path(expanduser('~/.thefuck')) rules_dir = user_dir.joinpath('rules') @@ -71,9 +71,9 @@ def wait_output(settings, popen): def get_command(settings, args): """Creates command from `args` and executes it.""" - if six.PY2: + if six.PY2: # pragma: no cover python-3 script = ' '.join(arg.decode('utf-8') for arg in args[1:]) - else: + else: # pragma: no cover python-2 script = ' '.join(args[1:]) if not script: diff --git a/thefuck/utils.py b/thefuck/utils.py index 2f58e527..3aedb0d3 100644 --- a/thefuck/utils.py +++ b/thefuck/utils.py @@ -8,10 +8,10 @@ from .types import Command DEVNULL = open(os.devnull, 'w') -if six.PY2: +if six.PY2: # pragma: no cover python-3 import pipes quote = pipes.quote -else: +else: # pragma: no cover python-2 import shlex quote = shlex.quote