def test_set_version(tmp_cwd):
    path = tmp_cwd / "my_version_path"
    path.write_text("my_version_var = '1.2.3'")

    set_new_version("X.Y.Z")

    assert path.read_text() == "my_version_var = 'X.Y.Z'"
def test_set_version(mock_config):
    set_new_version("X.Y.Z")

    handle_open = mock_version_file()
    mock_version_file.assert_any_call("my_version_path", mode="w")
    mock_version_file.assert_any_call("my_version_path", mode="r")
    handle_open.read.assert_called_once_with()
    handle_open.write.assert_called_once_with("my_version_var = 'X.Y.Z'")
    mock_version_file.reset_mock()
예제 #3
0
def test_set_version(mock_config):

    set_new_version('X.Y.Z')

    handle_open = mock_version_file()
    mock_version_file.assert_any_call('my_version_path', mode='w')
    mock_version_file.assert_any_call('my_version_path', mode='r')
    handle_open.read.assert_called_once_with()
    handle_open.write.assert_called_once_with('my_version_var = \'X.Y.Z\'')
    mock_version_file.reset_mock()