mirror of
https://github.com/TheLocehiliosan/yadm
synced 2026-03-02 03:49:29 +00:00
Add --version and --help as yadm internal commands (#267)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
"""Test help"""
|
||||
import pytest
|
||||
|
||||
|
||||
def test_missing_command(runner, yadm_cmd):
|
||||
@@ -9,9 +10,10 @@ def test_missing_command(runner, yadm_cmd):
|
||||
assert run.out.startswith('Usage: yadm')
|
||||
|
||||
|
||||
def test_help_command(runner, yadm_cmd):
|
||||
@pytest.mark.parametrize('cmd', ['--help', 'help'])
|
||||
def test_help_command(runner, yadm_cmd, cmd):
|
||||
"""Run with help command"""
|
||||
run = runner(command=yadm_cmd('help'))
|
||||
run = runner(command=yadm_cmd(cmd))
|
||||
assert run.failure
|
||||
assert run.err == ''
|
||||
assert run.out.startswith('Usage: yadm')
|
||||
|
||||
@@ -21,8 +21,9 @@ import pytest
|
||||
'pre-post-success',
|
||||
'pre-post-fail',
|
||||
])
|
||||
@pytest.mark.parametrize('cmd', ['--version', 'version'])
|
||||
def test_hooks(
|
||||
runner, yadm_cmd, paths,
|
||||
runner, yadm_cmd, paths, cmd,
|
||||
pre, pre_code, post, post_code):
|
||||
"""Test pre/post hook"""
|
||||
|
||||
@@ -33,7 +34,7 @@ def test_hooks(
|
||||
create_hook(paths, 'post_version', post_code)
|
||||
|
||||
# run yadm
|
||||
run = runner(yadm_cmd('version'))
|
||||
run = runner(yadm_cmd(cmd))
|
||||
# when a pre hook fails, yadm should exit with the hook's code
|
||||
assert run.code == pre_code
|
||||
assert run.err == ''
|
||||
|
||||
@@ -26,10 +26,11 @@ def test_semantic_version(expected_version):
|
||||
'does not conform to MAJOR.MINOR.PATCH')
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cmd', ['--version', 'version'])
|
||||
def test_reported_version(
|
||||
runner, yadm_cmd, expected_version):
|
||||
runner, yadm_cmd, cmd, expected_version):
|
||||
"""Report correct version"""
|
||||
run = runner(command=yadm_cmd('version'))
|
||||
run = runner(command=yadm_cmd(cmd))
|
||||
assert run.success
|
||||
assert run.err == ''
|
||||
assert run.out == f'yadm {expected_version}\n'
|
||||
|
||||
Reference in New Issue
Block a user