Пример #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))
Пример #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))
Пример #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
Пример #4
0
def test_pep440_version_pattern(version):
    assert PEP440_VERSION_PATTERN.match(version)
Пример #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
Пример #6
0
def test_pep440_version_pattern(version):
    assert PEP440_VERSION_PATTERN.match(version)