diff options
author | 2020-03-03 19:45:46 -0800 | |
---|---|---|
committer | 2020-03-03 19:46:27 -0800 | |
commit | 93f29f8bfee77957770dab3dd9adc1dac62d0bb2 (patch) | |
tree | 349daa827b6936155b967fe9b1cfcfae2e6af801 /tests/base.py | |
parent | CI: add a restore key for the pre-commit cache (diff) |
CI: mock the pipenv binary
The mock gets used by the flake8 pre-commit hook, which invokes flake8
via `pipenv run flake8`. It's normally useful to use pipenv here cause
it ensures flake8 is invoked within the context of the venv. However, in
CI, there is no venv - dependencies are installed directly to the
system site-packages. `pipenv run` does not work in such case because it
tries to create a new venv if one doesn't exist (it doesn't consider the
system interpreter to be a venv).
This workaround (okay, it's a hack) creates an executable shell script
which replaces the original pipenv binary. The shell script simply
ignores the first argument (i.e. ignores `run` in `pipenv run`) and
executes the rest of the arguments as a command. It essentially makes
`pipenv run flake8` equivalent to just having ran `flake8`. When
pre-commit executes pipenv, the aforementioned script is what will run.
Diffstat (limited to 'tests/base.py')
0 files changed, 0 insertions, 0 deletions