]> Nutra Git (v1) - nutratech/cli.git/commitdiff
contextual patch()
authorShane Jaroch <chown_tee@proton.me>
Fri, 12 Apr 2024 21:53:47 +0000 (17:53 -0400)
committerShane Jaroch <chown_tee@proton.me>
Fri, 12 Apr 2024 21:53:47 +0000 (17:53 -0400)
tests/test_init.py

index cc938faf6ba69f9723b245ad1da069f19a9125d3..27074ef47a0c0d5ecda66cbae5ca7e126edfc8ad 100644 (file)
@@ -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",