@@ -258,13 +258,12 @@ def test_current_version_not_equal_pyproject_toml_version(self):
258258            PythonVersionCommand ,
259259            "version_file_path" ,
260260            new = PropertyMock (return_value = fake_version_py ),
261+         ), self .assertRaisesRegex (
262+             VersionError ,
263+             "The version .* in .* doesn't match the current version .*." ,
261264        ):
262265            cmd  =  PythonVersionCommand ()
263-             with  self .assertRaisesRegex (
264-                 VersionError ,
265-                 "The version .* in .* doesn't match the current version .*." ,
266-             ):
267-                 cmd .verify_version (Version ("1.2.3" ))
266+             cmd .verify_version (Version ("1.2.3" ))
268267
269268    def  test_current_version (self ):
270269        fake_version_py  =  Path ("foo.py" )
@@ -287,6 +286,30 @@ def test_current_version(self):
287286            cmd  =  PythonVersionCommand ()
288287            cmd .verify_version ("current" )
289288
289+     def  test_current_failure (self ):
290+         fake_version_py  =  Path ("foo.py" )
291+         content  =  (
292+             '[tool.poetry]\n version = "1.2.4"\n ' 
293+             '[tool.pontos.version]\n version-module-file = "foo.py"' 
294+         )
295+ 
296+         with  temp_file (
297+             content , name = "pyproject.toml" , change_into = True 
298+         ), patch .object (
299+             PythonVersionCommand ,
300+             "get_current_version" ,
301+             MagicMock (return_value = Version ("1.2.3" )),
302+         ), patch .object (
303+             PythonVersionCommand ,
304+             "version_file_path" ,
305+             new = PropertyMock (return_value = fake_version_py ),
306+         ), self .assertRaisesRegex (
307+             VersionError ,
308+             "The version .* in .* doesn't match the current version .*." ,
309+         ):
310+             cmd  =  PythonVersionCommand ()
311+             cmd .verify_version ("current" )
312+ 
290313    def  test_provided_version_missmatch (self ):
291314        fake_version_py  =  Path ("foo.py" )
292315        content  =  (
0 commit comments