Conversation
Write to stderr instead of stdout when changing Matplotlib interactivity. Otherwise the doctests will fail when debugging them. I tested this by changing it manually on my VSCode instance 😁.
|
I think this is okay, but what is failing with writing to stdout? |
Whatever you write to stdout appears in the doctest output, and thus it does not match the expected output anymore, failing the test. |
| enable_gui_function(gui) | ||
| if not matplotlib.is_interactive(): | ||
| sys.stdout.write("Backend %s is interactive backend. Turning interactive mode on.\n" % backend) | ||
| sys.stderr.write("Backend %s is interactive backend. Turning interactive mode on.\n" % backend) |
There was a problem hiding this comment.
I'm thinking this shouldn't write to either. It should probably write to the log instead.
That would be something like this instead:
| sys.stderr.write("Backend %s is interactive backend. Turning interactive mode on.\n" % backend) | |
| pydev_log.debug("Backend %s is interactive backend. Turning interactive mode on.\n" % backend) |
There was a problem hiding this comment.
Of course after importing pdev_log. Maybe that causes some import problems though and it's why this code was writing to stdout.
There was a problem hiding this comment.
I changed it to stderr because I saw it writing to stderr in other places in the same file, but logging is fine to me, as long as it does not end in stdout.
There was a problem hiding this comment.
Yeah not sure why it's writing to stderr instead of log elsewhere. I believe this code was originally a port from somewhere else and maybe whomever ported it didn't bother to make it write to the log instead.
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Write to stderr instead of stdout when changing Matplotlib interactivity. Otherwise the doctests will fail when debugging them.
I tested this by changing it manually on my VSCode instance 😁.