How can I source a bash script that contains exports for environment variables?
env.sh
...
export VARIABLE=test
...
test_file.py
...
os.environ['VARIABLE'] # Throws KeyError
...
How can I use pre-commit to run env.sh to setup an environment that the following pytest hook can use?
- repo: local
hooks:
- id: tests
name: run tests
entry: pytest -v
language: system
types: [python]
pre-commit-config
Ex.
- repo: local
hooks:
- id: tests
name: run tests
entry: bash tests.sh
language: python
tests.sh
source env.sh
pytest -v .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With