[TIP] py.test skip messages not showing up
holger at merlinux.eu
Thu Dec 20 01:11:49 PST 2012
On Wed, Dec 19, 2012 at 16:59 -0500, Pella,Chris wrote:
> > -----Original Message-----
> > From: holger krekel [mailto:holger at merlinux.eu]
> > Sent: December-19-12 3:46 PM
> > To: Pella,Chris
> > Cc: testing-in-python at lists.idyll.org
> > Subject: Re: [TIP] py.test skip messages not showing up
> > On Wed, Dec 19, 2012 at 11:52 -0500, Pella,Chris wrote:
> > > We have some tests that are being skipped if some preconditions are
> > missed...
> > > e.g.
> > > if source_type == 'unsupported':
> > > pytest.skip("Unsupported configuration.")
> > >
> > > We are hoping to be able to see that "Unsupported configuration" string in
> > the stdout so we can see why a test was skipped. How do we get py.test to
> > send that string to stdout? Also, as a general suggestion it would be nice to
> > have pytest send an lf so that it the pytest output doesn't run into our
> > logging output, as you can see below.
> > Did you try the "-r" option? for example to report skip messages: -rs
> I am trying that.
> > > Below is a snippet of Jenkins console from one of our tests.
> > > 2012-12-19 03:15:19,224:module:lunacm:INFO:HSM init completed
> > > successfully PASSED
> > > testcases/rbs/test_backup_init.py:48:
> > TestRBSInit.test_backup_factory_reset[remote] SKIPPED2012-12-19
> > 03:15:19,239:module:lunacm:INFO:LunaCM destroyed...
> > > 2012-12-19 03:15:19,640:module:Install_Client:INFO:
> > Uninstalling Luna Client running /bin/bash
> > /usr/safenet/lunaclient/bin/uninstall.sh...
> > Hum, not sure i understand what's happening here. This seems to be a
> > py.test run in verbose mode? Why is it mixed with logging output?
> > Usually py.test would capture such output. IOW, could you give a bit more
> > context on how/what you are invoking here?
> I'm invoking the tests in Jenkins with py.test -v -s --junitxml=<filename> <path_to_test_directory>
> I'm running it as a Jenkins job. The logging messages are not coming from test tests themselves, but from helper functions/classes that the tests are using. I assume that because we are using the -s option it is printing everything to the console. I want to see the logging messages because we have a complex functional test bed with many resources and helper classes to manage them and we need to see what is happening.
You assume right about the "-s" option. But i guess you are aware that if
you wouldn't use "-s", that you would still see the logging messages in case
of failing tests? If you want to see testing and logging information
also for passing tests then you probably need to write a little extension
to do that. There is no builtin support in the current terminal reporter
and it would need a "mangling-safe" way of doing that.
> > best,
> > holger
> > >
> > > Chris
> > >
> > > The information contained in this electronic mail transmission may be
> > > privileged and confidential, and therefore, protected from disclosure.
> > > If you have received this communication in error, please notify us
> > > immediately by replying to this message and deleting it from your
> > > computer without copying or disclosing it.
> > >
> > >
> > > _______________________________________________
> > > testing-in-python mailing list
> > > testing-in-python at lists.idyll.org
> > > http://lists.idyll.org/listinfo/testing-in-python
> The information contained in this electronic mail transmission
> may be privileged and confidential, and therefore, protected
> from disclosure. If you have received this communication in
> error, please notify us immediately by replying to this
> message and deleting it from your computer without copying
> or disclosing it.
More information about the testing-in-python