This is a modification of Pamela fox's starter which is awesome!
This is a template repository for any Python project that uses docopt to create a beautiful command-line interface. It comes with the following dev tools:
ruff
which identifies many errors and style issues (flake8, isort, pyupgrade)black
a code formatter- pytest for testing
- pytest-cov to measure code coverage
ruff
and black
are run as pre-commit hooks using the pre-commit library. The checks and tests are all run using Github actions on every pull request and merge to main.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements-dev.txt
pre-commit install # to setup git hook scripts
python3 -m pytest
- Run program
python src/main.py -h
python -m pytest # regular run
python -m pytest -v # run verbose
python -m pytest --cov-src tests # run tests with coverage report
-
Skip a particular test by decorating the test with
@pytest.mark.skip(reason="...")
and then runpython -m pytest [-v]
# mytest.py @pytest.mark.skip(reason="Not implemented yet") def test_booboo: assert True
$ pytest -m pytest [-v]
-
Only Run one test by decorating the test with
@pytest.mark.only
and then runpython -m pytest -[v]k only
@pytest.mark.only def test_booboo: assert True
$ pytest -m pytest -k only