-
Notifications
You must be signed in to change notification settings - Fork 1
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 #43 from smart-on-fhir/mikix/version
feat: add --version
- Loading branch information
Showing
3 changed files
with
38 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,22 @@ | ||
"""Tests for cli.py""" | ||
|
||
import chart_review | ||
from chart_review import cli | ||
from tests import base | ||
|
||
|
||
class TestCommandLine(base.TestCase): | ||
"""Test case for the CLI entry point""" | ||
|
||
def test_version(self): | ||
# Manually capture stdout (rather than helper self.run_cli) because --version actually | ||
# exits the program, and we have to handle the exception rather than just grabbing the | ||
# return value which would be more convenient. | ||
with self.capture_stdout() as stdout: | ||
with self.assertRaises(SystemExit) as cm: | ||
cli.main_cli(["--version"]) | ||
|
||
self.assertEqual(0, cm.exception.code) | ||
|
||
version = chart_review.__version__ | ||
self.assertEqual(f"chart-review {version}\n", stdout.getvalue()) |