Skip to content

pytest framework

NaveenS edited this page Apr 19, 2020 · 3 revisions

Introduction

Pytest is a Python library for testing Python applications. It can be used for all types and levels of software testing

Conventions for Python test discovery

Files - test_*.py or *_test.py files

Functions or Method - test_ prefixed test functions or methods outside of class

Class - Test_ prefixed test classes

Simple example

Create a .py (sample.py) file with below code

def test_01():
     assert 5==6

Execute the code by providing below command in terminal

pytest sample.py
Clone this wiki locally