Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/python_inspector/resolve_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@

TRACE = False

__version__ = "0.6.3"
__version__ = "0.6.4"

DEFAULT_PYTHON_VERSION = "38"
PYPI_SIMPLE_URL = "https://pypi.org/simple"


def print_version(ctx, param, value):
if not value or ctx.resilient_parsing:
return
click.echo(f"Python-inspector version: {__version__}")
ctx.exit()


@click.command()
@click.pass_context
@click.option(
Expand Down Expand Up @@ -155,6 +162,15 @@
hidden=True,
help="Enable debug output.",
)
@click.option(
"-V",
"--version",
is_flag=True,
is_eager=True,
expose_value=False,
callback=print_version,
help="Show the version and exit.",
)
@click.help_option("-h", "--help")
def resolve_dependencies(
ctx,
Expand Down
2 changes: 1 addition & 1 deletion tests/data/default-url-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--specifier zipp==3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/pinned-requirements.txt-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 38",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/setup/simple-setup.py-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--index-url https://pypi.org/simple",
"--python-version 27",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/single-url-except-simple-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--specifier flask",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/single-url-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--specifier zipp==3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/tilde_req-expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"headers": {
"tool_name": "python-inspector",
"tool_homepageurl": "https://github.com/nexB/python-inspector",
"tool_version": "0.6.3",
"tool_version": "0.6.4",
"options": [
"--specifier zipp~=3.8.0",
"--index-url https://pypi.org/simple",
Expand Down
6 changes: 6 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ def test_passing_of_json_pdt_and_json_flags():
run_cli(options=options, expected_rc=1)


def test_version_option():
options = ["--version"]
result = run_cli(options=options)
assert "0.6.4" in result.output


def test_passing_of_netrc_file_that_does_not_exist():
options = ["--specifier", "foo", "--netrc", "bar.txt", "--json", "-"]
run_cli(options=options, expected_rc=2)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_resolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def test_without_supported_wheels():
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/[email protected]",
"pkg:pypi/setuptools@65.2.0",
"pkg:pypi/setuptools@65.3.0",
"pkg:pypi/[email protected]",
]

Expand Down