Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 도커
- Django
- nosql
- 테라폼 기본 문법
- 파이썬
- Bash
- AWS
- sftp란
- 도커컴포즈
- DynamoDB
- BIG-O NOTATION
- 테라폼 문법
- docker-compose
- iterm2 단축키
- 컨테이너
- linux
- customize
- server
- 빅오노테이션
- python
- iterm2 shortcuts
- zsh
- minikube 설치 방법
- minikube mac 설치
- test
- Shell
- docker
- terraform
- terraform 문법
- zshrc
Archives
- Today
- Total
sklass의 s-class 프로그래밍 blog
[Django] unittest @tag 본문
django test를 할때 명령어에서 특정 테스트만 테스트하게끔 하고 싶을때 @tag를 사용하면 수월합니다.
아래와 같이 테스트 함수 위에 @tag를 달아주세요.
@tag("greeting")
def test_hello(self) -> None:
print("hello")
@tag("introduce")
def test_name(self) -> None:
print("Joseph")
@tag("greeting", "welcome")
def test_welcome(self) -> None:
print("welcome")
이렇게 하고 아래 명령어를 실행하면 됩니다.
python3 manage.py test --tag="greeting"
>> hello
>> welcome
python3 manage.py test --tag="welcome"
>> welcome
python3 manage.py test --tag="greeting" --tag="introduce"
>> hello
>> Joseph
>> welcome
python3 manage.py test --exclude-tag="greeting" --tag="introduce"
>> Joseph
*** 참고로 django unittest는 test함수명의 alphabetical order로 진행됩니다.
'django' 카테고리의 다른 글
[Django] model의 데이터를 가져오는 get()과 filter()의 차이 (0) | 2021.12.03 |
---|---|
[django] drf의 request.data.get() (0) | 2021.10.22 |
[Django] test 명령어 argument customize (0) | 2021.09.11 |
[Django] Signals (0) | 2021.09.10 |
[Django] manage.py 명령어 Customize (0) | 2021.09.10 |