Exemple #1
0
def test_remove_prefix_function():
    """Test `utils.remove_prefix()` function"""
    text = 'prefix-actual-text'

    assert utils.remove_prefix(text, 'prefix-') == 'actual-text'
    assert utils.remove_prefix(text, 'prefix-', silent=False) == 'actual-text'

    assert utils.remove_prefix(text, 'non-prefix') == text

    with pytest.raises(ValueError):
        utils.remove_prefix(text, 'non-prefix', silent=False)
Exemple #2
0
    def _normalize_tag_name(name):
        """
        Normalizes GitHub tag name to be a PEP 404 compliant version name,
        which in this case means removing 'version-' prefix
        Example:
            version-3.16.2 -> 3.16.2

        :param name: tag name
        :type name: str
        :returns: normalized version name
        :rtype: str
        """
        return remove_prefix(name, 'version-')
Exemple #3
0
    def _normalize_tag_name(name):
        """
        Normalizes GitHub tag name to be a PEP 404 compliant version name

        :param name: tag name
        :type name: str
        :returns: normalized version name
        :rtype: str
        """
        # Don't ask me why but this repository contains both `mysql`
        # and `mysql-cluster` versions, so we have to split it in
        # two checkers and ignore one type
        if name.startswith('mysql-') and not name.startswith('mysql-cluster'):
            return ''

        # mysql-cluster-7.4.14 -> 7.4.14
        return remove_prefix(name, 'mysql-cluster-')
Exemple #4
0
    def _normalize_tag_name(name):
        """
        Normalizes GitHub tag name to be a PEP 404 compliant version name,
        which in this case means removing 'REL' prefix and replacing
        underscores with dots
        Example:
            REL9_2_20 -> 9.2.20

        :param name: tag name
        :type name: str
        :returns: normalized version name
        :rtype: str
        """
        # REL9_2_20 -> 9_2_20
        name = remove_prefix(name, 'REL')

        # 9_2_20 -> 9.2.20
        return name.replace('_', '.')
Exemple #5
0
    def _normalize_tag_name(name):
        """
        Normalizes GitHub tag name to be a PEP 404 compliant version name,
        which in this case means removing 'rabbitmq_' prefix and replacing
        underscores with dots
        Example:
            rabbitmq_v3_6_8 -> v3.6.8

        :param name: tag name
        :type name: str
        :returns: normalized version name
        :rtype: str
        """
        # rabbitmq_v3_6_8 -> v3_6_8
        name = remove_prefix(name, 'rabbitmq_')

        # v3_6_8 -> v3.6.8
        return name.replace('_', '.')
Exemple #6
0
    def _normalize_tag_name(name):
        """
        Normalizes GitHub tag name to be a PEP 404 compliant version name

        :param name: tag name
        :type name: str
        :returns: normalized version name
        :rtype: str
        """
        # Don't ask me why but this repository contains both `mysql`
        # and `mysql-cluster` versions, so we have to split it in
        # two checkers and ignore one type
        if name.startswith('mysql-cluster'):
            return ''

        # Also, there is a '8.0.0' release even though it's a development
        # preview version
        if name == 'mysql-8.0.0':
            return name + 'rc1'

        # mysql-5.6.35 -> 5.6.35
        return remove_prefix(name, 'mysql-')