Skip to content

Commit c8ade24

Browse files
Use default INDEX_URL from Settings
This avoids overriding the `INDEX_URL` tuple in `Settings` with the default value from `click` and enables the use of environment variables for `PYINSP_INDEX_URL`. Signed-off-by: Marcel Bochtler <[email protected]>
1 parent 4a91a4d commit c8ade24

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/python_inspector/resolve_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import click
1515

16+
from python_inspector import pyinspector_settings
1617
from python_inspector import settings
1718
from python_inspector import utils_pypi
1819
from python_inspector.cli_utils import FileOptionType
@@ -93,8 +94,7 @@ def print_version(ctx, param, value):
9394
type=str,
9495
metavar="INDEX",
9596
show_default=True,
96-
# since multiple is True, this is a sequence
97-
default=[settings.PYPI_SIMPLE_URL],
97+
default=pyinspector_settings.INDEX_URL,
9898
multiple=True,
9999
help="PyPI simple index URL(s) to use in order of preference. "
100100
"This option can be used multiple times.",

tests/data/single-url-env-var-except-simple-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"tool_name": "python-inspector",
44
"tool_homepageurl": "https://github.com/aboutcode-org/python-inspector",
55
"options": [
6-
"--index-url https://pypi.org/simple",
6+
"--index-url https://thirdparty.aboutcode.org/pypi/simple/",
77
"--json <file>",
88
"--operating-system linux",
99
"--python-version 38",

tests/data/tilde_req-expected-env.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"tool_homepageurl": "https://github.com/aboutcode-org/python-inspector",
55
"options": [
66
"--index-url https://pypi.org/simple",
7+
"--index-url https://thirdparty.aboutcode.org/pypi/simple",
78
"--json <file>",
89
"--operating-system linux",
910
"--python-version 38",

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def test_cli_with_multiple_env_var_index_url_and_tilde_req():
231231
expected_file = test_env.get_test_loc("tilde_req-expected-env.json", must_exist=False)
232232
specifier = "zipp~=3.8.0"
233233
os.environ["PYINSP_INDEX_URL"] = (
234-
"https://pypi.org/simple https://thirdparty.aboutcode.org/pypi/simple/"
234+
"https://pypi.org/simple https://thirdparty.aboutcode.org/pypi/simple"
235235
)
236236
check_specs_resolution(
237237
specifier=specifier,

0 commit comments

Comments
 (0)