From 9328c6bb781520509bb64ffdc31152e4c7c3734f Mon Sep 17 00:00:00 2001 From: Simon Li Date: Wed, 22 Jun 2022 20:22:44 +0100 Subject: [PATCH] Test non-existent version request --- tests/test_bootstrap_functions.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_bootstrap_functions.py b/tests/test_bootstrap_functions.py index ba4b3f5..c579ac8 100644 --- a/tests/test_bootstrap_functions.py +++ b/tests/test_bootstrap_functions.py @@ -106,7 +106,7 @@ bde6b66287e3d157f2577bcaf2e986af020139f4 refs/tags/2.1.1 ("1", "1.5.0"), ("1.0", "1.0.0"), ("1.2", "1.2.2"), - # ("1.100", None), + ("1.100", None), ("2.0.0", "2.0.0"), ("random-branch", "random-branch"), ("1234567890abcdef", "1234567890abcdef"), @@ -120,4 +120,9 @@ def test_resolve_git_version(monkeypatch, requested, expected): monkeypatch.setattr(bootstrap, "run_subprocess", mock_run_subprocess) - assert bootstrap._resolve_git_version(requested) == expected + if expected is None: + with pytest.raises(Exception) as exc: + bootstrap._resolve_git_version(requested) + assert exc.value.args[0].startswith("No version matching 1.100 found") + else: + assert bootstrap._resolve_git_version(requested) == expected