下面是我的项目的. project config.yaml文件。
# See https://pre-commit.com/hooks.html for more hooks
fail_fast: true
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: local
hooks:
- id: isort
name: isort
entry: isort
language: python
types: [python]
- repo: local
hooks:
- id: black
name: black
entry: black
language: python
types: [python]
- repo: local
hooks:
- id: pytest-check
name: pytest-check
#entry: pytest tests/test_file2.py
entry: pytest
language: python
#args: [--maxfail=1]
#stages: [post-commit]
pass_filenames: false
always_run: false我想做两件事,如下所述。
有时候,
FYI. -我已经探索过一种绕过预提交的方法,但是它适用于.pre config.yaml文件中提到的所有钩子。
我们如何才能实现这两种情况?请提出您的意见,在相同的?
发布于 2022-06-15 08:20:33
将您的测试变成一个shell脚本,该脚本实际上执行,
pytest tests/test_file2.py (or whatever you are doing now)
true最后一个命令也可以是exit 0,或者其他成功退出的命令。)这样,测试就会运行,有了现在的副作用和输出,但是git将始终将它们视为成功。
https://stackoverflow.com/questions/72627974
复制相似问题