August 2018
Intermediate to advanced
466 pages
10h 23m
English
The first pytest example will be a simple assert for two values:
$ cat chapter13_6_pytest_1.py#!/usr/bin/env python3def test_passing(): assert(1, 2, 3) == (1, 2, 3)def test_failing(): assert(1, 2, 3) == (3, 2, 1)
When you run with the -v option, pytest will give us a pretty robust answer for the failure reason:
$ pytest -v chapter13_6_pytest_1.py============================== test session starts ===============================platform linux -- Python 3.5.2, pytest-3.6.3, py-1.5.4, pluggy-0.6.0 -- /usr/bin/python3cachedir: .pytest_cacherootdir: /home/echou/Master_Python_Networking_second_edition/Chapter13, inifile:collected 2 itemschapter13_6_pytest_1.py::test_passing PASSED [ 50%]chapter13_6_pytest_1.py::test_failing FAILED ...
Read now
Unlock full access