usage features
Filter warnings
create a file called pytest.ini with following contents
[pytest]
addopts = -p no:warning
Print the intermediate Output
include -s at the end of pytest command
repeat pytest
using decorator @pytest.mark.repeat(n)
#install
pip install pytest-repeat
Benchmark your Code
test speed of the function code
!pip install pytest-benchmark
def concat(len_list=1000):
l = []
for i in range(len_list):
l = l + [i]
return l
def test_concat(benchmark):
len_list = 1000
res = benchmark.pedantic(concat, kwargs={'len_list': len_list}, iterations=100)
assert res == list(range(len_list))
#start spytest with visualization
pytest test_benchmark.py --benchmark-histogram