pytest document

Doctest integration for modules and test files

2 minute read

기본적으로 test*.txt에 매칭되는 파일은 파이썬 스탠다드 모듈에서 실행됩니다. 이 패턴은 다음 코드를 실행함으로 바꿀 수 있습니다.

Temporary directories and files

1 minute read

8.1 The tmp_path fixture tmp_path fixture 를 사용해서 테스트를 부르는데 임시 주소를 제공합니다. tmp_path는 pathlib/pathlib2.Path object입니다. 예시:

Monkeypatching/mocking modules and environments

1 minute read

종종 테스트를 진행할 때 글로벌 세팅이나 네트워크 접근과 같은 상황에서 코드를 불러 와야하는 어려운 상황이 있습니다. Pytest에서 제공하는 The monkeypatch fixture 는 이를 불러 오는데에 큰 역할을 합니다.

pytest fixture(3)

4 minute read

매개 변수화된 fixture에 표시하기 pytest.param()은 @pytest.mark.parametrize같이 매개 변수화 된 fixture 값 세트에 표시를 하는데 사용할 수 있습니다.

pytest fixture(2)

5 minute read

Fixture 종료/ teardown 코드 실행 pytest는 fixtrue의 범위를 벗어 났을 때 특정 fixtuer의 종료 코드 실행을 지원합니다. return 대신 yield문을 사용하면 yield문 다음의 모든 코드가 teardown 코드로 사용됩니다. ```python c...

pytest fixture

5 minute read

test fixture를 쓰는 목적은 테스트가 안정적이고 반복적으로 실행될 수 잇는 고정된 기준점을 제공하는 것입니다. pytest fixture는 고전적인 xUnit 스타일의 설정/해제 기능을 극적으로 향상시킵니다. fixture는 명시적인 이름을 가지며, 테스트 함수, 모...

기존의 시험장(test suite)에서의 pytest

less than 1 minute read

pytest는 대부분의 기존 시험장을 사용할 수 있습니다. 하지만 pytest는 nose나 다른 Python의 기본적인 unittest framework와는 다르게 작동합니다.

사용법 그리고 실행방법(2)

2 minute read

Dropping to PDB (Python Debugger) on failures Python은 PDB라 불리는 내장된 Python debugger와 같이 설치됩니다. pytest는 아래와 같은 command line 상 명령어를 통해 PDB prompt로 들어갑니다.

사용법 그리고 실행방법(1)

4 minute read

Terminal command로 python을 이용하더라도, -m 옵션 flag를 통해 pytest를 실행할 수 있습니다. python -m pytest

설치 및 실행

3 minute read

Pythons: Python 2.7, 3.4, 3.5, 3.6, 3.7, Jython, PyPy-2.3 Platforms: Unix/Posix and Windows PyPI 패키지 이름: pytest PDF 다운로드: 최신 버전 다운로드