question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Module and class headings are to late on stdout

See original GitHub issue

green

I would name line #4 the module heading and line #5 the class heading

The output from line 2 & 3 comes from the setUpClass() method.

I would assume that the heading for module is print to stdout before setUpModul() is called and the heading for the class before the call of setUpClass().

What do you think?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
CleanCutcommented, May 12, 2020

I finished my investigation. Green has never supported capturing output from module/class setups or teardowns, despite me thinking I had implemented that. Though I would like to add this as a feature, it is extremely difficult and I am not planning on taking it on. If someone would like to give it a try, I’d be happy to collaborate on a pull request. The place to start is green/suite.py in GreenTestSuite.run.

The workaround is: Don’t write to stdout/stderr in class/module setups or teardowns.

I updated the documentation for -a/--allow-stdout to point out that we only capture output for tests, not setups and teardowns.

0reactions
CleanCutcommented, May 13, 2020

No problem! Sorry I couldn’t provide a more satisfying response in this instance. This is the drawback of hitching Green to unittest – having to deal with it’s internal implementation. On the other hand, there’s no barrier to using Green nor any “vendor lock-in”. Always tradeoffs!

Read more comments on GitHub >

github_iconTop Results From Across the Web

stylegan2-ada-pytorch/util.py at main - GitHub
"""Convenience class that behaves like a dict but allows access with the attribute ... """Redirect stderr to stdout, optionally print stdout to a...
Read more >
python - Intercepting assignments to sys.stdout and sys.stderr
This works as expected - at any time after my module is imported, trying to do anything with sys.stdout or sys.stderr goes through...
Read more >
Standard Output in Java: Definition & Examples - Study.com
The standard output in Java is the PrintStream class accessed through the System.out field. By default, standard output prints to the display, ...
Read more >
1. Extending Python with C or C++ — Python 3.11.1 ...
We discuss the use of PyMODINIT_FUNC as a function return type later in this sample. The spam.error exception can be raised in your...
Read more >
Python Tutorial - File and Text Processing
File Input/Output. File Input/Ouput (IO) requires 3 steps: Open the file for read or write or both. Read/Write data. Close the file to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found