Functions and Classes in Python

Solutions

In [5]:
!pytest mypkg/test/test_mymath.py::test_mul
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.3.1, py-1.5.0, pluggy-0.6.0
rootdir: /home/lester/Code/siremol.org/chryswoods.com/python_and_data/testing, inifile:
collected 4 items                                                              
mypkg/test/test_mymath.py ....                                           [100%]
=========================== 4 passed in 0.01 seconds ===========================

In [6]:
!pytest mypkg --duration=3
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.3.1, py-1.5.0, pluggy-0.6.0
rootdir: /home/lester/Code/siremol.org/chryswoods.com/python_and_data/testing, inifile:
collected 17 items                                                             
mypkg/test/test_errors.py .s                                             [ 11%]
mypkg/test/test_mymath.py x.......s......                                [100%]
=========================== slowest 3 test durations ===========================
2.70s call     mypkg/test/test_mymath.py::test_bigSum
0.00s setup    mypkg/test/test_errors.py::test_indexError
0.00s call     mypkg/test/test_mymath.py::test_isLucky
=============== 14 passed, 2 skipped, 1 xfailed in 2.74 seconds ================