Skip to content

Commit

Permalink
Merge pull request #46 from unnonouno/version-option
Browse files Browse the repository at this point in the history
Add verison option
  • Loading branch information
unnonouno authored May 15, 2017
2 parents fd6bd1a + 341f4b6 commit cb1ba1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cudnnenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ def deactivate(args):

def main(args=None):
parser = argparse.ArgumentParser()
parser.add_argument(
'--version', action='version', version='cudnnenv %s' % __version__)
subparsers = parser.add_subparsers(help='Subcommand')

sub = subparsers.add_parser('install', help='Install version')
Expand Down
4 changes: 4 additions & 0 deletions test/test_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ def clear_stdout(self):
self.stdout = StringIO()
sys.stdout = self.stdout

def test_version(self):
with self.assertRaises(SystemExit) as cont:
self.call_main('--version')

def test_no_subcommand(self):
with self.assertRaises(SystemExit) as cont:
self.call_main()
Expand Down

0 comments on commit cb1ba1f

Please sign in to comment.