From d48a9d9cfd89c72de9e33f8bc45125df435fd483 Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Mon, 28 Oct 2024 15:56:46 +0100 Subject: [PATCH] test: verify `call_git_oneline()` always raises for anything but a single line The previous commit homogenized the exception to always be `AssertionError`. --- datalad_core/runners/tests/test_callgit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/datalad_core/runners/tests/test_callgit.py b/datalad_core/runners/tests/test_callgit.py index cd45abf..008fa77 100644 --- a/datalad_core/runners/tests/test_callgit.py +++ b/datalad_core/runners/tests/test_callgit.py @@ -36,9 +36,15 @@ def test_call_git_lines(): def test_call_git_oneline(): line = call_git_oneline(['--version']) assert line.startswith('git version') + # raise when there is more than oneline with pytest.raises(AssertionError): - # TODO: may not yield multiple lines on all systems - call_git_oneline(['config', '-l']) + call_git_oneline(['rev-parse', '--git-dir', '--git-common-dir']) + # raise when there is no line + with pytest.raises(AssertionError): + call_git_oneline( + ['stripspace'], + inputs='', + ) def test_iter_git_subproc():