Skip to content

Commit f09b3fc

Browse files
committed
Use better error message
for missing requirement files Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent bcf68e9 commit f09b3fc

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/python_inspector/resolve_cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ def resolve_dependencies(
216216
invalid_requirement_files.append(req_file)
217217

218218
if invalid_requirement_files:
219+
invalid_requirement_files = "\n".join(invalid_requirement_files)
219220
click.secho(
220-
f"""The following requirement files are not valid pip
221-
requirement file names: {invalid_requirement_files}""",
221+
"The following requirement files are not valid pip "
222+
f"requirement file names: \n{invalid_requirement_files}",
222223
err=True,
223224
)
224225
ctx.exit(1)

tests/data/pdt.txt

Whitespace-only changes.

tests/test_cli.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,16 @@ def test_passing_of_netrc_file_that_does_not_exist():
218218

219219

220220
def test_passing_of_wrong_requiremts_file():
221-
test_file = test_env.get_test_loc("pdt.txt")
222-
options = ["--requirement", test_file, "--json", "-"]
223-
run_cli(options=options, expected_rc=1)
221+
test_file = test_env.get_temp_file(file_name="pdt.txt", extension="")
222+
with open(test_file, "w") as f:
223+
f.write("")
224+
test_file_2 = test_env.get_temp_file(file_name="setup.py", extension="")
225+
with open(test_file_2, "w") as f:
226+
f.write("")
227+
options = ["--requirement", test_file, "--json", "-", "--requirement", test_file_2]
228+
result = run_cli(options=options, expected_rc=1)
229+
assert "pdt.txt" in result.output
230+
assert "setup.py" in result.output
224231

225232

226233
def test_passing_of_no_json_output_flag():

0 commit comments

Comments
 (0)