[Libguestfs] [PATCH] python: tests: use more targeted assert*() functions/checks

Pino Toscano ptoscano at redhat.com
Fri Feb 12 17:29:48 UTC 2016


On Friday 12 February 2016 17:13:17 Richard W.M. Jones wrote:
> On Fri, Feb 12, 2016 at 06:04:47PM +0100, Pino Toscano wrote:
> > - use assertIsInstance, assertNotEqual, and assertIsNotNone as more
> >   specific checks (will produce better logging)
> > - use assertRaises when expecting exceptions being thrown
> > - when testing internal_test_rhashtable, instead of checking type and
> >   elements of the return values just check the return value as a whole
> >   (easier and already getting all the work needed by unittest)
> 
> Good find!  I was going by the documentation which didn't mention any
> of these asserts.

Hm I see all of them in
  https://docs.python.org/2.7/library/unittest.html#test-cases

> ACK, assuming it also works with python3, ie this passes:
> 
>   PYTHON=/usr/bin/python3 ./configure && make && make -C test-data check && make -C python check

Usually I try on a Python3-only distribution (== Archlinux).  Since
they passed there too, I pushed it.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20160212/3109b4ce/attachment.sig>


More information about the Libguestfs mailing list