Unit Testing - Squelching Print Statements

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
semireg
Posts: 14
Joined: Mon Dec 18, 2017 3:53 pm

Unit Testing - Squelching Print Statements

Post by semireg » Fri Apr 06, 2018 12:47 am

I'm running unit tests within the unix port and some functions generate output via print. Is there a way to temporarily disable standard output from within the micropython environment, or redirect one output to another? I see sys.stderr and sys.stdout but it's not obvious how to manipulate them.

User avatar
pythoncoder
Posts: 3068
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Unit Testing - Squelching Print Statements

Post by pythoncoder » Fri Apr 06, 2018 5:31 am

Is print(data, file=f) any help?
Peter Hinch

jickster
Posts: 532
Joined: Thu Sep 07, 2017 8:57 pm

Re: Unit Testing - Squelching Print Statements

Post by jickster » Tue Jul 10, 2018 7:17 pm

pythoncoder wrote:
Fri Apr 06, 2018 5:31 am
Is print(data, file=f) any help?
What if print is called internally?
jickster wrote:
Tue Jul 10, 2018 7:15 pm
This was a question in another thread
LisaM wrote:
Wed Nov 08, 2017 6:05 pm
But... Help("modules") does show a list of frozen modules so the info is available in micropython (at least on esp32). Is there a way of redirecting the help output into a string for parsing (again on a esp32)?
but it definitely is a thread itself.

Post Reply