-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
When a coverage check fails, it will raise an entire stack trace with the message subprocess.CalledProcessError: Command '{some_command}' returned non-zero exit status 1.. Instead, we should handle errors like ruff-pre-commit does.
- Error code 2: Below coverage threshold
- Error code 5: No tests ran.
Example
coverage.................................................................Failed
- hook id: coverage-pre-commit
- exit code: 1
Traceback (most recent call last):
File "C:\Users\Gabriel\.cache\pre-commit\repo4pboq7zs\py_env-python3.12\Lib\site-packages\coverage_pre_commit\coverage_runner.py", line 95, in main
sys.exit(execute_command(build_command(provider, args)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Gabriel\.cache\pre-commit\repo4pboq7zs\py_env-python3.12\Lib\site-packages\coverage_pre_commit\util\command.py", line 51, in execute_command
).check_returncode()
^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\subprocess.py", line 502, in check_returncode
raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command 'pytest --cov=. tests/ --cov-fail-under=95.0' returned non-zero exit status 1.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request