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

Safety 2.x fails when git is not installed #397

Merged
merged 1 commit into from
Jul 18, 2022
Merged

Safety 2.x fails when git is not installed #397

merged 1 commit into from
Jul 18, 2022

Conversation

andyjones
Copy link
Contributor

Thanks for safety!

I get the following error running safety 2.x:

FileNotFoundError: [Errno 2] No such file or directory: 'git'
Unhandled exception happened: [Errno 2] No such file or directory: 'git'

It looks like Safety 2.x introduces some checks to see if this is in a git repo. This check fails when the git binary is unavailable (eg. running safety against a dockerised application).

Reproduce the issue by running safety when git is not in the path eg.

python -m venv .venv
. .venv/bin/activate
pip install safety
PATH="`pwd`.venv/bin" safety check

@codecov
Copy link

codecov bot commented Jul 18, 2022

Codecov Report

Merging #397 (2f0bbd5) into develop (fac16b6) will decrease coverage by 0.09%.
The diff coverage is 50.00%.

@@             Coverage Diff             @@
##           develop     #397      +/-   ##
===========================================
- Coverage    86.14%   86.05%   -0.10%     
===========================================
  Files           14       14              
  Lines         1711     1714       +3     
===========================================
+ Hits          1474     1475       +1     
- Misses         237      239       +2     
Impacted Files Coverage Δ
safety/util.py 81.37% <50.00%> (-0.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fac16b6...2f0bbd5. Read the comment docs.

@cb22
Copy link
Contributor

cb22 commented Jul 18, 2022

Hey @andyjones - thanks for the PR!

We're going to merge this in ASAP and get 2.1.1 released with it included.

Looks like all of our tests run in containers that have git installed, so we didn't pick this up before release - I'll add a few new cases once the release is out to make sure we catch this case going forward.

@cb22 cb22 merged commit 00d4633 into pyupio:develop Jul 18, 2022
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.

None yet

2 participants