Skip to content

Commit

Permalink
coverageの取得手順を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
ot-nemoto committed Jun 16, 2024
1 parent 8be91d3 commit d08ae51
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"extensions": [
"charliermarsh.ruff",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker"
"ms-azuretools.vscode-docker",
"ms-vscode.live-server"
]
}
},
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
__pycache__
data
data
.coverage
htmlcov
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,43 @@ python manage.py createsuperuser
```

_http://127.0.0.1:8000/admin/_

### Writing your first Django app, part 5

テスト実行

```sh
python manage.py test polls
```

カバレッジ取得

```sh
coverage run --source='.' manage.py test polls

# Report
coverage report
# Name Stmts Miss Cover
# ------------------------------------------------------
# manage.py 11 2 82%
# mysite/__init__.py 0 0 100%
# mysite/asgi.py 4 4 0%
# mysite/settings.py 18 0 100%
# mysite/urls.py 3 0 100%
# mysite/wsgi.py 4 4 0%
# polls/__init__.py 0 0 100%
# polls/admin.py 3 0 100%
# polls/apps.py 4 0 100%
# polls/migrations/0001_initial.py 6 0 100%
# polls/migrations/__init__.py 0 0 100%
# polls/models.py 17 2 88%
# polls/tests.py 57 0 100%
# polls/urls.py 4 0 100%
# polls/views.py 29 8 72%
# ------------------------------------------------------
# TOTAL 160 20 88%

# HTML report
coverage html
# Wrote HTML report to htmlcov/index.html
```
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
django
mysqlclient
mysqlclient
coverage

0 comments on commit d08ae51

Please sign in to comment.