unit testing - print success messages for asserts in python -


i using assert in python. every time assert fails failure message have put there printed. wondering if there way print custom success message when assert condition passes ? using py.test framework.

example:

assert self.clnt.stop_io()==1, "io stop failed" 

for above assert message "io stop failed" if assert fails looking have "io stop succeeded" if assert passes. like

 assert self.clnt.stop_io()==1, "io stop failed", "io stop succeeded" 

yes, simplest surely place print below assert:

assert self.clnt.stop_io()==1, "io stop failed" print("io stop passed @ location ==1") 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -