Question on pytest example code

Robert rxjwg98 at gmail.com
Sun Jan 10 14:38:17 EST 2016


Hi,

Below is a code snippet from pytest package. It passes pytest, i.e. there is
no failure report.


# content of test_sysexit.py
import pytest

def f():
     raise SystemExit(1)

def test_mytest():
     with pytest.raises(SystemExit):
          f()


I see that f() will generate 'SystemExit(1)'. Then what does function
test_mytest()?

Is it missing some assert line?
The above code is from page 5 (9 of 93) of 'pytest Documentation' 
Release 2.8.2

Thanks,



More information about the Python-list mailing list