unittest vs py.test?
Roy Smith
roy at panix.com
Mon Apr 4 19:59:20 EDT 2005
In article <pan.2005.04.04.23.26.28.468507 at jerf.org>,
Jeremy Bowers <jerf at jerf.org> wrote:
> On Mon, 04 Apr 2005 22:50:35 +0000, John J. Lee wrote:
> > What I don't understand about py.test (and trying it out seems
> > unlikely to answer this) is why it uses the assert statement.
> > unittest used to do that, too, but then it was pointed out that that
> > breaks when python -O is used, so unittest switched to self.assert_
> > &c. Does py.test have some way around that?
>
> "Don't use -O because it doesn't do anything significant?"
>
> Is this an issue in practice? (Honest question.) If -O did something
> interesting I might use it, but I don't think it does.
The following program produces different output depending on whether you
run it with -O or not:
try:
assert 0
print "I am running with -O"
except AssertionError:
print "I'm not"
More information about the Python-list
mailing list