Skip to content

Commit

Permalink
Added release exception to click cli runner
Browse files Browse the repository at this point in the history
  • Loading branch information
gtalarico committed May 11, 2018
1 parent 1396799 commit c5851d3
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
""" Tests for `pipenv_pipes` cli."""

import pytest # noqa: F401
import traceback
from pipenv_pipes.cli import pipes


#

def test_cli_help(runner):
help_result = runner.invoke(pipes, args=['--help'])
assert help_result.exit_code == 0
Expand All @@ -15,7 +18,7 @@ def test_cli_help(runner):

def test_cli_version(runner):
from pipenv_pipes import __version__
result = runner.invoke(pipes, args=['--version'])
result = runner.invoke(pipes, args=['--version'], catch_exceptions=False)
assert result.exit_code == 0
assert __version__ in result.output

Expand All @@ -32,25 +35,29 @@ def test_cli_no_args(runner):


def test_cli_no_args_verbose(runner):
result = runner.invoke(pipes, ['--verbose'])
result = runner.invoke(pipes, ['--verbose'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'PIPENV_HOME' in result.output


def test_cli_list(runner):
result = runner.invoke(pipes, args=['--list'])
result = runner.invoke(pipes, args=['--list'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'proj1' in result.output


def test_cli_list_verbose(runner):
result = runner.invoke(pipes, args=['--list', '--verbose'])
result = runner.invoke(pipes, args=['--list', '--verbose'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'PIPENV_HOME' in result.output


def test_no_match(runner):
result = runner.invoke(pipes, args=['projxxx'])
result = runner.invoke(pipes, args=['projxxx'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'no matches' in result.output.lower()

Expand All @@ -63,21 +70,24 @@ def test_many_match(runner):

@pytest.mark.slow
def test_one_match_do_shell(runner_slow):
result = runner_slow.invoke(pipes, args=['proj1'], input='exit')
result = runner_slow.invoke(pipes, args=['proj1'], input='exit',
catch_exceptions=False)
assert result.exit_code == 0
assert 'terminating pipes shell' in result.output.lower()


@pytest.mark.slow
def test_one_match_unlink(runner_slow):
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'])
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'project directory cleared' in result.output.lower()


@pytest.mark.slow
def test_one_match_no_link(runner_slow):
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'])
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'project directory cleared' in result.output.lower()

Expand All @@ -89,7 +99,8 @@ def test_one_match_no_link(runner_slow):

@pytest.mark.slow
def test_do_link(runner_slow):
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'])
result = runner_slow.invoke(pipes, args=['proj1', '--unlink'],
catch_exceptions=False)
assert result.exit_code == 0
assert 'project directory cleared' in result.output.lower()

Expand All @@ -100,7 +111,8 @@ def test_do_link(runner_slow):


def test_do_link_no_assoc_env(runner, temp_folder):
result = runner.invoke(pipes, args=['--link', temp_folder])
result = runner.invoke(pipes, args=['--link', temp_folder],
catch_exceptions=False)
assert result.exception
assert 'looking for associated' in result.output.lower()
assert 'no virtualenv has been created' in result.output.lower()
Expand Down

0 comments on commit c5851d3

Please sign in to comment.