CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
791 stars 75 forks source link

Add --quiet-stdout option #114

Closed nMustaki closed 8 years ago

nMustaki commented 8 years ago

I am testing a Flask application which is very verbose, and I only need the added output if the test fail. So this option should only display stdout/stderr if the test is not successful. I am not sure about the best way to integrate this with your current tests can you help me on that ? Thanks !

CleanCut commented 8 years ago

I like it! This looks like a great feature.

A few issues:

Once there are at least some tests that cover it, I'd be happy to merge.

nMustaki commented 8 years ago

Great you like the idea ! I can only think of one test to add, so I'd glad to have your input on what's missing

    def test_printErrorsStdoutQuietStdout(self):
        """
        printErrors() prints out the captured stdout
        except when quiet_stdout is set to True
        """
        self.args.quiet_stdout = True
        gtr = GreenTestResult(self.args, GreenStream(self.stream))
        pt = MyProtoTest()
        output = 'this is what the test should not spit out to stdout'
        gtr.recordStdout(pt, output)
        gtr.addSuccess(pt)
        gtr.printErrors()
        self.assertNotIn(output, self.stream.getvalue())
CleanCut commented 8 years ago

It's in 2.3.0, which was just released!

nMustaki commented 8 years ago

Great!