From: Shane Jaroch Date: Fri, 12 Apr 2024 21:53:47 +0000 (-0400) Subject: contextual patch() X-Git-Tag: v0.2.8.dev2~39 X-Git-Url: https://git.nutra.tk/v2?a=commitdiff_plain;h=efe4dcff37c7bc55df8e043c0efb0a9b38ccdfe4;p=nutratech%2Fcli.git contextual patch() --- diff --git a/tests/test_init.py b/tests/test_init.py index cc938fa..27074ef 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -11,14 +11,13 @@ import pytest from ntclient import version_check -@patch("sys.version_info", (3, 4, 0)) def test_archaic_python_version_raises_runtime_error() -> None: """Test that the correct error is raised when the Python version is too low.""" - with pytest.raises(RuntimeError) as exc_info: - version_check() - assert "ERROR: nutra requires Python 3.4.3 or later to run" in str(exc_info.value) - assert "HINT: You're running Python 3.4.0" in str(exc_info.value) + with patch("sys.version_info", (3, 4, 0)): + with pytest.raises(RuntimeError) as exc_info: + version_check() + assert exc_info.type == RuntimeError assert exc_info.value.args == ( "ERROR: nutra requires Python 3.4.3 or later to run",