1212import pytest
1313from packaging .requirements import Requirement
1414
15+ from python_inspector .resolution import get_resolved_dependencies
1516from python_inspector .resolution import is_valid_version
1617from python_inspector .resolution import pypi_simple_repo_in_repos
17- from python_inspector .resolution import resolution
1818from python_inspector .utils_pypi import PYPI_PUBLIC_REPO
1919from python_inspector .utils_pypi import Environment
2020
2121
2222@pytest .mark .online
23- def test_resolvelib_with_flask_and_python_310 ():
23+ def test_get_resolved_dependencies_with_flask_and_python_310 ():
2424 req = [Requirement ("flask==2.1.2" )]
25- as_list = resolution (
25+ results = get_resolved_dependencies (
2626 requirements = req ,
2727 environment = Environment (
2828 python_version = "310" ,
2929 operating_system = "linux" ,
3030 ),
3131 repos = [PYPI_PUBLIC_REPO ],
32- return_as_parent_children = False ,
33- return_as_list = True ,
32+ as_tree = False ,
3433 )
34+ as_list = [p ["package" ] for p in results ]
3535 assert as_list == [
3636 "pkg:pypi/click@8.1.3" ,
3737 "pkg:pypi/flask@2.1.2" ,
@@ -45,18 +45,18 @@ def test_resolvelib_with_flask_and_python_310():
4545
4646
4747@pytest .mark .online
48- def test_resolvelib_with_flask_and_python_36 ():
48+ def test_get_resolved_dependencies_with_flask_and_python_36 ():
4949 req = [Requirement ("flask==2.1.2" )]
50- as_list = resolution (
50+ results = get_resolved_dependencies (
5151 requirements = req ,
5252 environment = Environment (
5353 python_version = "36" ,
5454 operating_system = "linux" ,
5555 ),
5656 repos = [PYPI_PUBLIC_REPO ],
57- return_as_parent_children = False ,
58- return_as_list = True ,
57+ as_tree = False ,
5958 )
59+ as_list = [p ["package" ] for p in results ]
6060
6161 assert as_list == [
6262 "pkg:pypi/click@8.1.3" ,
@@ -71,14 +71,10 @@ def test_resolvelib_with_flask_and_python_36():
7171
7272
7373@pytest .mark .online
74- def test_resolvelib_with_tilde_requirement_using_json_api ():
74+ def test_get_resolved_dependencies_with_tilde_requirement_using_json_api ():
7575 req = [Requirement ("flask~=2.1.2" )]
76- as_list = resolution (
77- requirements = req ,
78- return_as_parent_children = False ,
79- return_as_list = True ,
80- )
81-
76+ results = get_resolved_dependencies (requirements = req , as_tree = False )
77+ as_list = [p ["package" ] for p in results ]
8278 assert as_list == [
8379 "pkg:pypi/click@8.1.3" ,
8480 "pkg:pypi/flask@2.1.2" ,
0 commit comments