def test_should_return_none_without_commits(self):
        """
        Make sure that we do not release if there are no commits since last release.
        """
        with mock.patch('semantic_release.history.config.getboolean', lambda *x: True):
            self.assertIsNone(evaluate_version_bump('1.1.0'))

        with mock.patch('semantic_release.history.config.getboolean', lambda *x: False):
            self.assertIsNone(evaluate_version_bump('1.1.0'))
def test_should_return_none_without_commits():
    """
    Make sure that we do not release if there are no commits since last release.
    """
    with mock.patch("semantic_release.history.config.get", lambda *x: True):
        assert evaluate_version_bump("1.1.0") is None

    with mock.patch("semantic_release.history.config.get", lambda *x: False):
        assert evaluate_version_bump("1.1.0") is None
    def test_should_return_none_without_commits(self):
        """
        Make sure that we do not release if there are no commits since last release.
        """
        with mock.patch('semantic_release.history.config.getboolean', lambda *x: True):
            self.assertIsNone(evaluate_version_bump('1.1.0'))

        with mock.patch('semantic_release.history.config.getboolean', lambda *x: False):
            self.assertIsNone(evaluate_version_bump('1.1.0'))
Exemplo n.º 4
0
def version(**kwargs):
    """
    Detects the new version according to git log and semver. Writes the new version
    number and commits it(unless the noop-option is True.
    """
    click.echo('Creating new version..')
    current_version = get_current_version()
    click.echo('Current version: {0}'.format(current_version))
    level_bump = evaluate_version_bump(current_version, kwargs['force_level'])
    new_version = get_new_version(current_version, level_bump)

    if new_version == current_version:
        click.echo(click.style('No release will be made.', fg='yellow'))
        return False

    if kwargs['noop'] is True:
        click.echo('{} Should have bumped from {} to {}.'.format(
            click.style('No operation mode.', fg='yellow'),
            current_version,
            new_version
        ))
        return False

    set_new_version(new_version)
    commit_new_version(new_version)
    tag_new_version(new_version)
    click.echo('Bumping with a {0} version to {1}.'.format(level_bump, new_version))
    return True
def test_major():
    with mock.patch(
            "semantic_release.history.logs.get_commit_log",
            lambda *a, **kw: ALL_KINDS_OF_COMMIT_MESSAGES,
    ):
        assert evaluate_version_bump("0.0.0") == "major"
def test_should_patch_without_tagged_commits():
    assert evaluate_version_bump("1.1.0") == "patch"
def test_should_not_skip_commits_mentioning_other_commits():
    with mock.patch(
            "semantic_release.history.logs.get_commit_log",
            lambda *a, **kw: MAJOR_MENTIONING_LAST_VERSION,
    ):
        assert evaluate_version_bump("1.0.0") == "major"
 def test_should_minor_with_patch_without_tag(self):
     self.assertEqual(evaluate_version_bump('1.1.0'), 'minor')
Exemplo n.º 9
0
 def test_nothing_if_no_tag(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: ['', '...']):
         self.assertIsNone(evaluate_version_bump('0.0.0'))
Exemplo n.º 10
0
 def test_major(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: ALL_KINDS_OF_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'major')
 def test_should_patch_without_tagged_commits(self):
     self.assertEqual(evaluate_version_bump('1.1.0'), 'patch')
 def test_should_account_for_commits_earlier_than_last_commit(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: MAJOR_LAST_RELEASE_MINOR_AFTER):
         self.assertEqual(evaluate_version_bump('1.1.0'), 'minor')
 def test_force(self):
     self.assertEqual(evaluate_version_bump('0.0.0', 'major'), 'major')
     self.assertEqual(evaluate_version_bump('0.0.0', 'minor'), 'minor')
     self.assertEqual(evaluate_version_bump('0.0.0', 'patch'), 'patch')
 def test_nothing_if_no_tag(self):
     with mock.patch('semantic_release.history.get_commit_log', lambda: ['', '...']):
         self.assertIsNone(evaluate_version_bump('0.0.0'))
 def test_patch(self):
     with mock.patch('semantic_release.history.get_commit_log', lambda: PATCH_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'patch')
 def test_major(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: ALL_KINDS_OF_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'major')
def test_should_minor_without_major_on_zero():
    assert evaluate_version_bump("0.1.0") == "minor"
Exemplo n.º 18
0
 def test_should_patch_without_tagged_commits(self):
     self.assertEqual(evaluate_version_bump('1.1.0'), 'patch')
Exemplo n.º 19
0
 def test_should_return_none_without_tagged_commits(self):
     self.assertIsNone(evaluate_version_bump('1.1.0'))
 def test_should_return_none_without_tagged_commits(self):
     self.assertIsNone(evaluate_version_bump('1.1.0'))
Exemplo n.º 21
0
 def test_patch(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: PATCH_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'patch')
Exemplo n.º 22
0
 def test_should_account_for_commits_earlier_than_last_commit(self):
     with mock.patch('semantic_release.history.get_commit_log',
                     lambda: MAJOR_LAST_RELEASE_MINOR_AFTER):
         self.assertEqual(evaluate_version_bump('1.1.0'), 'minor')
Exemplo n.º 23
0
 def test_force(self):
     self.assertEqual(evaluate_version_bump('0.0.0', 'major'), 'major')
     self.assertEqual(evaluate_version_bump('0.0.0', 'minor'), 'minor')
     self.assertEqual(evaluate_version_bump('0.0.0', 'patch'), 'patch')
def test_nothing_if_no_tag():
    with mock.patch(
            "semantic_release.history.logs.get_commit_log",
            lambda *a, **kw: [("", "...")],
    ):
        assert evaluate_version_bump("0.0.0") is None
def test_patch():
    with mock.patch(
            "semantic_release.history.logs.get_commit_log",
            lambda *a, **kw: PATCH_COMMIT_MESSAGES,
    ):
        assert evaluate_version_bump("0.0.0") == "patch"
 def test_should_minor_with_patch_without_tag(self):
     self.assertEqual(evaluate_version_bump("1.1.0"), "minor")
def test_force():
    assert evaluate_version_bump("0.0.0", "major") == "major"
    assert evaluate_version_bump("0.0.0", "minor") == "minor"
    assert evaluate_version_bump("0.0.0", "patch") == "patch"
 def test_should_patch_without_tagged_commits(self):
     self.assertEqual(evaluate_version_bump("1.1.0"), "patch")
def test_should_minor_with_patch_without_tag():
    assert evaluate_version_bump("1.1.0") == "minor"
 def test_force(self):
     self.assertEqual(evaluate_version_bump("0.0.0", "major"), "major")
     self.assertEqual(evaluate_version_bump("0.0.0", "minor"), "minor")
     self.assertEqual(evaluate_version_bump("0.0.0", "patch"), "patch")
def test_should_return_none_without_tagged_commits():
    assert evaluate_version_bump("1.1.0") is None
Exemplo n.º 32
0
 def test_should_not_skip_commits_mentioning_other_commits(self):
     with mock.patch('semantic_release.history.logs.get_commit_log',
                     lambda *a, **kw: MAJOR_MENTIONING_LAST_VERSION):
         self.assertEqual(evaluate_version_bump('1.0.0'), 'major')
Exemplo n.º 33
0
 def test_minor(self):
     with mock.patch('semantic_release.history.logs.get_commit_log',
                     lambda *a, **kw: MINOR_AND_PATCH_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'minor')
 def test_minor(self):
     with mock.patch('semantic_release.history.logs.get_commit_log',
                     lambda *a, **kw: MINOR_AND_PATCH_COMMIT_MESSAGES):
         self.assertEqual(evaluate_version_bump('0.0.0'), 'minor')