-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import os | ||
import pytest | ||
|
||
from unittest.mock import patch | ||
|
||
from tempfile import TemporaryDirectory | ||
|
||
from ci_tools.functions import resolve_compatible_package, is_package_compatible | ||
from typing import Optional, List | ||
from packaging.version import Version | ||
from pkg_resources import Requirement | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_requirements, immutable_requirements, expected_result", | ||
[([Requirement("sphinx==1.0.0")], [Requirement("sphinx>=1.0.0")], True), | ||
([Requirement("sphinx==1.0.0")], [Requirement("sphinx>=1.1.0")], False)], | ||
) | ||
def test_incompatible_specifier(fake_package_input_requirements, immutable_requirements, expected_result): | ||
result = is_package_compatible("fake-package", fake_package_input_requirements, immutable_requirements) | ||
assert result == expected_result | ||
|
||
|
||
def test_identity_resolution(): | ||
result = resolve_compatible_package( | ||
"azure-identity", | ||
"1.18.1", | ||
[Requirement("azure-core>=1.28.0"), Requirement("isodate>=0.6.1"), Requirement("typing-extensions>=4.0.1")], | ||
) | ||
assert result == "azure-identity==1.16.0" |