Skip to content

Commit

Permalink
add a couple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scbedd committed Oct 2, 2024
1 parent 6c6cc93 commit 150b282
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/azure-sdk-tools/ci_tools/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ def handle_incompatible_minimum_dev_reqs(
This function is used to handle the case where a dev requirement is incompatible with the current set of packages
being installed. This is used to update or remove dev_requirements that are incompatible with a targeted set of packages.
:param str setup_path: The path to the setup.py file whos dev_requirements are being filtered.
:param str setup_path: The path to the setup.py file whose dev_requirements are being filtered.
:param List[str] filtered_requirement_list: A filtered copy of the dev_requirements.txt for the targeted package. This list will be
modified in place to remove any requirements incompatible with the packages_for_install.
Expand Down
22 changes: 19 additions & 3 deletions tools/azure-sdk-tools/tests/test_conflict_resolution.py
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"

0 comments on commit 150b282

Please sign in to comment.