Skip to content

Commit

Permalink
[MRG + 1] Test UsageError for CLI (#122)
Browse files Browse the repository at this point in the history
* add .vscode

* add tests for UsageError

* fix pep8
  • Loading branch information
vaibhavmule authored and vinayak-mehta committed Oct 4, 2018
1 parent 9d00937 commit 58eddd0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ coverage.xml

.pytest_cache/
_build/

# vscode
.vscode
20 changes: 19 additions & 1 deletion tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ def test_cli_lattice():
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'

result = runner.invoke(cli, ['--format', 'csv',
'lattice', infile])
output_error = 'Error: Please specify output file path using --output'
assert output_error in result.output

result = runner.invoke(cli, ['--output', outfile,
'lattice', infile])
format_error = 'Please specify output file format using --format'
assert format_error in result.output


def test_cli_stream():
with TemporaryDirectory() as tempdir:
Expand All @@ -31,4 +41,12 @@ def test_cli_stream():
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile,
'stream', infile])
assert result.exit_code == 0
assert result.output == 'Found 1 tables\n'
assert result.output == 'Found 1 tables\n'

result = runner.invoke(cli, ['--format', 'csv', 'stream', infile])
output_error = 'Error: Please specify output file path using --output'
assert output_error in result.output

result = runner.invoke(cli, ['--output', outfile, 'stream', infile])
format_error = 'Please specify output file format using --format'
assert format_error in result.output

0 comments on commit 58eddd0

Please sign in to comment.