These setup commands only need to be executed once. First, clone the repository:
git clone https://github.com/custom-components/pyscript.git
cd pyscriptNext, create a virtual environment (make sure python is at least v3.7; you might need to use
python3 instead):
python -m venv venv
source venv/bin/activateFinally, install the requirements and the pre-commit hooks:
python -m pip install -r tests/requirements_test.txt
pre-commit installTo submit PRs you will want to fork the repository, and follow the steps above on your forked repository. Once you have pushed your changes to the fork (which should run the pre-commit hooks), you can go ahead and submit a PR.
This directory contains various tests for pyscript.
After completing the above setup steps, you need to activate the virtual environment every time you start a new shell:
source venv/bin/activateNow you can run the tests using this command:
pytestor run a specific test file with:
pytest tests/test_function.pyYou can check coverage and list specific missing lines with:
pytest --cov=custom_components/pyscript --cov-report term-missing