SlideShare a Scribd company logo
1 of 32
More Effective Python 1st
2017년 9월 5일
WAPPLES개발부 | 심경섭
About Test & Style
I. Background
II. Unit Test
III. Coverage
IV. Various Python Version
V. Python Style
목차
Background
Property
4
Property
5
Property
6
Property
7
Yield
8
• Generator
• Yield
• Coroutine
Unit Test
• Python Unit Test Tool
• https://docs.pytest.org/en/latest/contents.html
• pip install pytest
Pytest
10
• 테스트 파일 이름
• Test_*.py || *_test.py
• 테스트 메소드/클래스 이름
• test_* || Test
• 커스텀 설정 가능
테스트 파일 이름
11
Parameters
12
• tmpdir 이라는 인자를 통해 임시파일 생성할 수 있음
임시 디렉토리
13
• tmpdir_factory 를 통해 테스트간 파일 공유가 가능
임시 디렉토리
14
• S/W 테스트시, 필요한 환경 설정을 미리 설정해둔 것들
• https://en.wikipedia.org/wiki/Test_fixture#Software
Fixtures
15
Setup in Fixture
16
Teardown in Fixture
17
Teardown in Fixture
18
Yield vs finalizer
19
• 여러 개의 teardown을 등록할 수 있음
• 등록된 경우, Exception이 발생해도 실행됨
Request
20
• 요청한 모듈의 속성을 가져올 수 있음
Request
21
• 파라미터를 사용할 수도 있음
Coverage
• pip install pytest-cov
Coverage
23
Various Python Version
• 다양한 파이썬 버전 테스트 지원
• 가상의 테스트 환경을 구축해서, 테스트
• 별도의 환경을 구축하기 때문에 setup.py 가 필요
Tox
25
Tox
26
Tox
27
Python Style
• Flake8
• pip install flake8
• Pylama
• https://github.com/klen/pylama
• PyFlake
• https://github.com/PyCQA/pyflakes
Code Convention
29
Code Convention
30
QnA
t h a n k y o u
Copyright 2017 Penta Security Systems Inc. All rights reserved.
KOREA
U.S.A.
JAPAN
Yeouido, Seoul www.pentasecurity.co.kr (HQ)
Houston, Texas www.pentasecurity.com
Shinjuku-Ku, Tokyo www.pentasecurity.co.jp

More Related Content

What's hot

제로부터시작하는 Git 두번째 이야기
제로부터시작하는 Git 두번째 이야기제로부터시작하는 Git 두번째 이야기
제로부터시작하는 Git 두번째 이야기Mario Cho
 
Git 기본개념과 사용법 그리고 어플리케이션
Git 기본개념과 사용법 그리고 어플리케이션Git 기본개념과 사용법 그리고 어플리케이션
Git 기본개념과 사용법 그리고 어플리케이션Dabi Ahn
 
Git의 개념과 사용
Git의 개념과 사용Git의 개념과 사용
Git의 개념과 사용환민 홍
 

What's hot (7)

제로부터시작하는 Git 두번째 이야기
제로부터시작하는 Git 두번째 이야기제로부터시작하는 Git 두번째 이야기
제로부터시작하는 Git 두번째 이야기
 
Git 기본개념과 사용법 그리고 어플리케이션
Git 기본개념과 사용법 그리고 어플리케이션Git 기본개념과 사용법 그리고 어플리케이션
Git 기본개념과 사용법 그리고 어플리케이션
 
RZDESK-Docker hackday
RZDESK-Docker hackdayRZDESK-Docker hackday
RZDESK-Docker hackday
 
Git 코드랩 스터디 1
Git 코드랩 스터디 1Git 코드랩 스터디 1
Git 코드랩 스터디 1
 
Git의 개념과 사용
Git의 개념과 사용Git의 개념과 사용
Git의 개념과 사용
 
Git
GitGit
Git
 
Git 코드랩 스터디 2
Git 코드랩 스터디 2Git 코드랩 스터디 2
Git 코드랩 스터디 2
 

Similar to Effective Python 1st (Test & Style)

Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Joongi Kim
 
Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Han Sung Kim
 
Python을 이용한 패키지 테스트 및 배포해보기
Python을 이용한 패키지 테스트 및 배포해보기Python을 이용한 패키지 테스트 및 배포해보기
Python을 이용한 패키지 테스트 및 배포해보기Lee Geonhee
 
Python packaging
Python packagingPython packaging
Python packagingJi Hun Kim
 
TestDFSIO
TestDFSIOTestDFSIO
TestDFSIOhhyin
 
[2013.07.16] PythonKorea강남스터디 발표 - flask testing
[2013.07.16] PythonKorea강남스터디 발표 - flask testing[2013.07.16] PythonKorea강남스터디 발표 - flask testing
[2013.07.16] PythonKorea강남스터디 발표 - flask testingDaeHyun Sung
 
파이썬 TDD 101
파이썬 TDD 101파이썬 TDD 101
파이썬 TDD 101정주 김
 
[1A7]Ansible의이해와활용
[1A7]Ansible의이해와활용[1A7]Ansible의이해와활용
[1A7]Ansible의이해와활용NAVER D2
 
공간정보아카데미 - Day1 오픈소스개발 일반
공간정보아카데미 - Day1 오픈소스개발 일반공간정보아카데미 - Day1 오픈소스개발 일반
공간정보아카데미 - Day1 오픈소스개발 일반BJ Jang
 
[오픈소스컨설팅]Ansible overview
[오픈소스컨설팅]Ansible overview[오픈소스컨설팅]Ansible overview
[오픈소스컨설팅]Ansible overviewOpen Source Consulting
 
[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdfHeeJung Chae
 
파이썬 소개
파이썬 소개파이썬 소개
파이썬 소개fermat39
 
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발Jeongkyu Shin
 
파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)Heungsub Lee
 
Python 생태계의 이해
Python 생태계의 이해Python 생태계의 이해
Python 생태계의 이해용 최
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol bufferknight1128
 
Vim for php
Vim for phpVim for php
Vim for phpSol Kim
 
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료DNAplusDroneWorkspac
 

Similar to Effective Python 1st (Test & Style) (20)

Exp manager
Exp managerExp manager
Exp manager
 
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
Python Korea 2014년 6월 세미나 - Windows 환경에서 Python 개발환경 세팅하기
 
Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료Django로 배우는 쉽고 빠른 웹개발 study 자료
Django로 배우는 쉽고 빠른 웹개발 study 자료
 
Python을 이용한 패키지 테스트 및 배포해보기
Python을 이용한 패키지 테스트 및 배포해보기Python을 이용한 패키지 테스트 및 배포해보기
Python을 이용한 패키지 테스트 및 배포해보기
 
Python packaging
Python packagingPython packaging
Python packaging
 
File fuzz testing
File fuzz testingFile fuzz testing
File fuzz testing
 
TestDFSIO
TestDFSIOTestDFSIO
TestDFSIO
 
[2013.07.16] PythonKorea강남스터디 발표 - flask testing
[2013.07.16] PythonKorea강남스터디 발표 - flask testing[2013.07.16] PythonKorea강남스터디 발표 - flask testing
[2013.07.16] PythonKorea강남스터디 발표 - flask testing
 
파이썬 TDD 101
파이썬 TDD 101파이썬 TDD 101
파이썬 TDD 101
 
[1A7]Ansible의이해와활용
[1A7]Ansible의이해와활용[1A7]Ansible의이해와활용
[1A7]Ansible의이해와활용
 
공간정보아카데미 - Day1 오픈소스개발 일반
공간정보아카데미 - Day1 오픈소스개발 일반공간정보아카데미 - Day1 오픈소스개발 일반
공간정보아카데미 - Day1 오픈소스개발 일반
 
[오픈소스컨설팅]Ansible overview
[오픈소스컨설팅]Ansible overview[오픈소스컨설팅]Ansible overview
[오픈소스컨설팅]Ansible overview
 
[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf[Ansible] Solution Guide V0.4_20181204.pdf
[Ansible] Solution Guide V0.4_20181204.pdf
 
파이썬 소개
파이썬 소개파이썬 소개
파이썬 소개
 
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
머신러닝 및 데이터 과학 연구자를 위한 python 기반 컨테이너 분산처리 플랫폼 설계 및 개발
 
파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)파이썬 생존 안내서 (자막)
파이썬 생존 안내서 (자막)
 
Python 생태계의 이해
Python 생태계의 이해Python 생태계의 이해
Python 생태계의 이해
 
Google Protocol buffer
Google Protocol bufferGoogle Protocol buffer
Google Protocol buffer
 
Vim for php
Vim for phpVim for php
Vim for php
 
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료
2021년도 DNA+드론 챌린지 지정공모 인프라활용교육자료
 

More from 경섭 심

Python Packaging & Debian Packaging
Python Packaging & Debian PackagingPython Packaging & Debian Packaging
Python Packaging & Debian Packaging경섭 심
 
Debian packaging - Advanced
Debian packaging - AdvancedDebian packaging - Advanced
Debian packaging - Advanced경섭 심
 
Debian packaging - basic process
Debian packaging - basic processDebian packaging - basic process
Debian packaging - basic process경섭 심
 
Ubuntu packaging - deploy package
Ubuntu packaging - deploy packageUbuntu packaging - deploy package
Ubuntu packaging - deploy package경섭 심
 
Ubuntu packaging - make package
Ubuntu packaging - make packageUbuntu packaging - make package
Ubuntu packaging - make package경섭 심
 
More Effective Python 3st (Multitask)
More Effective Python 3st (Multitask)More Effective Python 3st (Multitask)
More Effective Python 3st (Multitask)경섭 심
 
Main Variable Program
Main Variable ProgramMain Variable Program
Main Variable Program경섭 심
 
Python comparing
Python comparingPython comparing
Python comparing경섭 심
 
Python coroutine
Python coroutinePython coroutine
Python coroutine경섭 심
 
Debian 패키지 관리 프로세스
Debian 패키지 관리 프로세스Debian 패키지 관리 프로세스
Debian 패키지 관리 프로세스경섭 심
 
Effective Python 2st (Decorator & Generator)
Effective Python 2st (Decorator & Generator)Effective Python 2st (Decorator & Generator)
Effective Python 2st (Decorator & Generator)경섭 심
 

More from 경섭 심 (11)

Python Packaging & Debian Packaging
Python Packaging & Debian PackagingPython Packaging & Debian Packaging
Python Packaging & Debian Packaging
 
Debian packaging - Advanced
Debian packaging - AdvancedDebian packaging - Advanced
Debian packaging - Advanced
 
Debian packaging - basic process
Debian packaging - basic processDebian packaging - basic process
Debian packaging - basic process
 
Ubuntu packaging - deploy package
Ubuntu packaging - deploy packageUbuntu packaging - deploy package
Ubuntu packaging - deploy package
 
Ubuntu packaging - make package
Ubuntu packaging - make packageUbuntu packaging - make package
Ubuntu packaging - make package
 
More Effective Python 3st (Multitask)
More Effective Python 3st (Multitask)More Effective Python 3st (Multitask)
More Effective Python 3st (Multitask)
 
Main Variable Program
Main Variable ProgramMain Variable Program
Main Variable Program
 
Python comparing
Python comparingPython comparing
Python comparing
 
Python coroutine
Python coroutinePython coroutine
Python coroutine
 
Debian 패키지 관리 프로세스
Debian 패키지 관리 프로세스Debian 패키지 관리 프로세스
Debian 패키지 관리 프로세스
 
Effective Python 2st (Decorator & Generator)
Effective Python 2st (Decorator & Generator)Effective Python 2st (Decorator & Generator)
Effective Python 2st (Decorator & Generator)
 

Effective Python 1st (Test & Style)