일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- SPL
- Python
- pandas
- mean
- GitHub
- CNN
- index
- mariadb
- Series
- synology
- SciPy
- install
- GT-S80
- pip
- ipad
- RNN
- Numpy
- imread
- dataframe
- LSTM
- Splunk
- E-P1
- keras
- 알고리즘
- DFS
- 삼성소프트웨어멤버십
- Lotto
- Button
- javascript
- pycharm
Archives
- Today
- Total
잠토의 잠망경
[vscode] unit test 설정 - with python 본문
VSCode로 python을 작성하려한다.
가장 기본이 되는 unittest를 하기 위한 환경 설정이 필요하여 기록으로 남긴다.
폴더 구성
index | 파일이름 |
---|---|
1 | settings.json |
2 | sample009_01.py |
3 | sample009_01_test.py |
사전 준비
{
"python.pythonPath": "C:\\Users\\xxxxx\\AppData\\Local\\Programs\\Python\\Python36\\python.exe",
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true
}
unit code sample
Target File()
# sample009_01.py
def sum(a:int, b:int):
return a+b
Test File(기본 형태)
# sample009_01_test.py
from sample009_01 import sum
import unittest
class Test_Sample01(unittest.TestCase):
def test_sum(self):
self.assertTrue(21 == sum(10, 11))
if __name__ == '__main__':
unittest.main()
사용된 사례
※ 임의로 error를 만듬