virtualenv .venv
- Workshop om virtualenvironment handling noen?pip install flake8
pip install pytest
Dette er jo en workshop, i mangel på kreativitet skal vi lage en romer-tall-converter.
- Lag en mappe som heter
tests
- Lag en enkel test
test_roman_converter.py
- Kjør med pytest/eventuelt sett opp VSCODE
- Installer
pip install pre-commit
- Sjekk at funker
pre-commit --version
- Lag en
.pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/flake8
rev:
hooks:
- id: flake8
- Installer scriptet
pre-commit install
- Cheat-sheet:
pre-commit
run: this is what pre-commit runs by default when committing. This will run all hooks against currently staged files.pre-commit run --all-files/-a
: run all the hooks against all the files. This is a useful invocation if you are using pre-commit in CI.pre-commit run flake8
: run the flake8 hook against all staged files.git ls-files -- '*.py' | xargs pre-commit run --files
: run all hooks against all *.py files in the repository.