-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from nicholasyager/feature/add_version_option
Feature: Add a `--version` flag to aid in debugging
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from click.testing import CliRunner | ||
|
||
from dbt_meshify.cli import get_version | ||
from dbt_meshify.main import cli | ||
|
||
|
||
def test_version_option(): | ||
"""When the --version option is passed, meshify returns the version and exits.""" | ||
|
||
runner = CliRunner() | ||
result = runner.invoke( | ||
cli, | ||
[ | ||
"--version", | ||
], | ||
) | ||
|
||
assert result.exit_code == 0 | ||
assert result.stdout.rstrip() == get_version() | ||
|
||
|
||
def test_no_command_prints_help(): | ||
"""When an invoked subcommand is not provided, print the help and exit.""" | ||
|
||
runner = CliRunner() | ||
result = runner.invoke(cli) | ||
|
||
assert result.exit_code == 0 | ||
|
||
help_result = runner.invoke(cli, ["--help"]) | ||
assert result.stdout == help_result.stdout |