Skip to content
Snippets Groups Projects
Commit 73489e3b authored by ulif's avatar ulif
Browse files

Make sure we get version infos from main.

parent bee5764f
No related branches found
Tags v0.2
No related merge requests found
...@@ -6,7 +6,7 @@ from io import StringIO ...@@ -6,7 +6,7 @@ from io import StringIO
from diceware import ( from diceware import (
SRC_DIR, RE_LANG_CODE, SPECIAL_CHARS, get_wordlist, SRC_DIR, RE_LANG_CODE, SPECIAL_CHARS, get_wordlist,
get_wordlist_path, insert_special_char, get_passphrase, get_wordlist_path, insert_special_char, get_passphrase,
handle_options, main, handle_options, main, __version__,
) )
...@@ -195,6 +195,15 @@ class TestDicewareModule(object): ...@@ -195,6 +195,15 @@ class TestDicewareModule(object):
expected_output = fd.read() expected_output = fd.read()
assert out == expected_output assert out == expected_output
def test_main_version(self, argv_handler, capsys):
# we can get version infos.
sys.argv = ['diceware', '--version']
with pytest.raises(SystemExit) as exc_info:
main()
assert exc_info.value.code == 0
out, err = capsys.readouterr()
assert __version__ in out
def test_main_argv(self, argv_handler): def test_main_argv(self, argv_handler):
# main() handles sys.argv if nothing is provided # main() handles sys.argv if nothing is provided
sys.argv = ['diceware', '--help'] sys.argv = ['diceware', '--help']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment