コード例 #1
0
def test_add_and_commit(mock_git):
    commit_new_version('1.0.0')
    pathfile = os.path.join('semantic_release', '__init__.py')
    mock_git.add.assert_called_once_with(pathfile)
    mock_git.commit.assert_called_once_with(
        m='1.0.0\n\nAutomatically generated by python-semantic-release',
        author="semantic-release <semantic-release>")
コード例 #2
0
 def test_add_and_commit(self, mock_run):
     commit_new_version('1.0.0')
     self.assertEqual(
         mock_run.call_args_list,
         [mock.call('git add semantic_release/__init__.py', hide=True),
          mock.call('git commit -m "1.0.0"', hide=True)]
     )
コード例 #3
0
def test_add_and_commit(mock_git, mocker, params):
    mocker.patch(
        "semantic_release.vcs_helpers.config.get",
        wrapped_config_get(**params["config"]),
    )

    commit_new_version(params["version"])

    for path in params["add_paths"]:
        mock_git.add.assert_any_call(path)

    mock_git.commit.assert_called_once_with(**params["commit_args"])
コード例 #4
0
def test_add_and_commit_with_author(mocker, mock_git):
    orig = config.get

    def wrapped_config_get(*args, **kwargs):
        if (len(args) >= 2 and args[0] == 'semantic_release'
                and args[1] == 'commit_author'):
            return 'foo <*****@*****.**>'

        return orig(*args, **kwargs)

    mocker.patch('semantic_release.vcs_helpers.config.get', wrapped_config_get)

    commit_new_version('1.0.0')

    mock_git.commit.assert_called_once_with(
        m='1.0.0\n\nAutomatically generated by python-semantic-release',
        author='foo <*****@*****.**>')
コード例 #5
0
def test_add_and_commit_with_author(mocker, mock_git):
    orig = config.get

    def wrapped_config_get(*args, **kwargs):
        if args[0] == "commit_author":
            return "foo <*****@*****.**>"

        return orig(*args, **kwargs)

    mocker.patch("semantic_release.vcs_helpers.config.get", wrapped_config_get)

    commit_new_version("1.0.0")

    mock_git.commit.assert_called_once_with(
        m="1.0.0\n\nAutomatically generated by python-semantic-release",
        author="foo <*****@*****.**>",
    )
コード例 #6
0
def test_add_and_commit(mock_git):
    commit_new_version('1.0.0')
    mock_git.add.assert_called_once_with('semantic_release/__init__.py')
    mock_git.commit.assert_called_once_with(m='1.0.0', author="semantic-release <semantic-release>")
コード例 #7
0
def test_add_and_commit(mock_git):
    commit_new_version('1.0.0')
    mock_git.add.assert_called_once_with('semantic_release/__init__.py')
    mock_git.commit.assert_called_once_with(
        m='1.0.0', author="semantic-release <semantic-release>")