File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -361,3 +361,27 @@ def test_show_no_args(tmp_path: Path, fixtures_path: Path):
361
361
362
362
assert result .exit_code == 0
363
363
assert result .output .strip () == expected_output .strip ()
364
+
365
+
366
+ def test_replace (mocker , tmp_path , fixtures_path ):
367
+ """The replace subcommand should replace the version in the file."""
368
+ # Arrange
369
+ toml_path = fixtures_path / "basic_cfg.toml"
370
+ config_path = tmp_path / "pyproject.toml"
371
+ shutil .copy (toml_path , config_path )
372
+
373
+ mocked_modify_files = mocker .patch ("bumpversion.cli.modify_files" )
374
+ runner : CliRunner = CliRunner ()
375
+ with inside_dir (tmp_path ):
376
+ result : Result = runner .invoke (cli .cli , ["replace" , "--new-version" , "1.1.0" ])
377
+
378
+ if result .exit_code != 0 :
379
+ print (result .output )
380
+
381
+ assert result .exit_code == 0
382
+
383
+ call_args = mocked_modify_files .call_args [0 ]
384
+ configured_files = call_args [0 ]
385
+ assert len (configured_files ) == 3
386
+ actual_filenames = {f .path for f in configured_files }
387
+ assert actual_filenames == {"setup.py" , "CHANGELOG.md" , "bumpversion/__init__.py" }
You can’t perform that action at this time.
0 commit comments