Exemplo n.º 1
0
    def add_package_dependency(self, package_name, version):
        """
        Add a package to the list of dependencies.

        :param package_name: The name of the package dependency
        :type package_name: str
        :param version: The (minimum) version of the package
        :type version: str
        """
        if not PEP440_VERSION_PATTERN.match(version):
            raise ValueError('Invalid Version: "{}"'.format(version))
        self.dependencies.add(PackageDependency(package_name, version))
Exemplo n.º 2
0
    def add_package_dependency(self, package_name, version):
        """
        Add a package to the list of dependencies.

        :param package_name: The name of the package dependency
        :type package_name: str
        :param version: The (minimum) version of the package
        :type version: str
        """
        if not PEP440_VERSION_PATTERN.match(version):
            raise ValueError('Invalid Version: "{}"'.format(version))
        self.dependencies.add(PackageDependency(package_name, version))
Exemplo n.º 3
0
def test_pep440_version_pattern_invalid():
    assert PEP440_VERSION_PATTERN.match("foo") is None
    assert PEP440_VERSION_PATTERN.match("_12_") is None
    assert PEP440_VERSION_PATTERN.match("version 4") is None
Exemplo n.º 4
0
def test_pep440_version_pattern(version):
    assert PEP440_VERSION_PATTERN.match(version)
Exemplo n.º 5
0
def test_pep440_version_pattern_invalid():
    assert PEP440_VERSION_PATTERN.match('foo') is None
    assert PEP440_VERSION_PATTERN.match('_12_') is None
    assert PEP440_VERSION_PATTERN.match('version 4') is None
Exemplo n.º 6
0
def test_pep440_version_pattern(version):
    assert PEP440_VERSION_PATTERN.match(version)