Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppressing Cherrypy's output when running unit tests using Nose

I'm using cherrypy to implement a web server and I use nose to run my unit tests. However, there is a lot of debug noise that nose catches and prints to stdout, even when I use the --nologcapture, particularly cherrypy's logging messages. That makes the testing output quite difficult to read.

I've thought that:

def setUp(self):
   cherrypy.config.update({ "server.logToScreen" : False })
   cherrypy.config.update({'log.screen': False})

together with --nologcapture option would suppress those messages, but apparently it does not.

Anyone knows how to get rid of those messages and have a nice clean test output, please?

like image 239
Tomas Brambora Avatar asked Feb 02 '26 10:02

Tomas Brambora


1 Answers

You did not mention which version of CherryPy you were using, but assuming 3.x based on what you are experiencing. I believe you need to add the following config option:

cherrypy.config.update({ "environment": "embedded" })

I was recently faced with the same issue when I was testing a CherryPy app with Twill.

like image 52
Heikki Toivonen Avatar answered Feb 04 '26 00:02

Heikki Toivonen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!