Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: write to the output file, not the Path object #437

Merged
merged 1 commit into from
Dec 15, 2022

Conversation

Julian
Copy link
Contributor

@Julian Julian commented Dec 14, 2022

I think #432 broke output when there aren't any vulns there are skips (in my case because I'm testing trunk) -- at least here, CI jobs are failing with e.g.:

format-audit: commands[1] /home/runner/work/jsonschema/jsonschema/.tox/format-audit/tmp> /home/runner/work/jsonschema/jsonschema/.tox/format-audit/bin/python -m pip_audit
No known vulnerabilities found
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/runner/work/jsonschema/jsonschema/.tox/format-audit/lib/python3.11/site-packages/pip_audit/__main__.py", line 8, in <module>
    audit()
  File "/home/runner/work/jsonschema/jsonschema/.tox/format-audit/lib/python3.11/site-packages/pip_audit/_cli.py", line 543, in audit
    print(formatter.format(result, fixes), file=args.output)
AttributeError: 'PosixPath' object has no attribute 'write'. Did you mean: 'drive'?
format-audit: exit 1 (2.26 seconds) /home/runner/work/jsonschema/jsonschema/.tox/format-audit/tmp> /home/runner/work/jsonschema/jsonschema/.tox/format-audit/bin/python -m pip_audit pid=1812
  format-audit: FAIL code 1 (21.72=setup[14.21]+cmd[5.25,2.26] seconds)
  evaluation failed :( (21.86 seconds)
Error: Process completed with exit code 1.

(from https://github.com/python-jsonschema/jsonschema/actions/runs/3699379673/jobs/6266694002#step:8:70)

This seems to fix things (though I still may be getting a ResourceWarning here...)

@tetsuo-cpp tetsuo-cpp self-assigned this Dec 15, 2022
@tetsuo-cpp
Copy link
Contributor

@Julian Thanks for contributing this fix!

@tetsuo-cpp
Copy link
Contributor

tetsuo-cpp commented Dec 15, 2022

@woodruffw I won't put anything in the changelog for this fix since it hasn't gone out in a release yet. I'll also follow up with a unit test to cover this code in test_cli.py.

Edit: Oops, I just realised this went out in a release. Let's cut a new one now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants