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
Post a Comment