- 학교 체육관 대관 공지사항이 올라오면 카카오톡으로 알림을 보내주는 app입니다.
- window 기준
- WSL
curl -sSL https://install.python-poetry.org | python3 -
- Powershell
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
poetry install
poetry run pytest
- print 같이 출력하기
-
poetry run pytest -s
-
- 특정 파일만 테스트 하기
- pyproject.toml 파일에서 tool.pytest.ini_options > addopts을
addopts = "--reuse-db
으로 변경 -
poetry run pytest reminder/tests/test_model.py
- 특정 파일 안에 있는 특정 함수만 테스트
-
poetry run pytest reminder/tests/test_model.py::test_create_school
- pyproject.toml 파일에서 tool.pytest.ini_options > addopts을
- pre-commit hook
pre-commit install
- pre-push hook
$ touch .git/hooks/pre-push
$ chmod +x .git/hooks/pre-push
$ cat <<EOF >> .git/hooks/pre-push
#!/bin/sh
poetry run pytest
status=$?
if [ $status != 0 ]; then
echo 'TEST FAILED! GIT PUSH REJECTED' && exit 1
else
exit 0
fi
EOF
- 테스트가 0개면 에거가 발생하기 때문에 적어도 1개의 테스트를 만들어서 진행하기