[Piglit] [PATCH 1/3] framework: Never redirect sys.stderr to /dev/null.

Dylan Baker baker.dylan.c at gmail.com
Tue Dec 8 07:38:40 PST 2015


On Tue, Dec 08, 2015 at 01:23:28PM +0000, Jose Fonseca wrote:
> Awful idea, as it prevents easy debugging/diagnosis of framework issues.
> 
> If the test is verbose, then the child process' stderr should be
> redirected, and not Python's process.
> ---
>  framework/tests/profile_tests.py    |  3 ---
>  framework/tests/run_parser_tests.py | 10 ----------
>  2 files changed, 13 deletions(-)
> 
> diff --git a/framework/tests/profile_tests.py b/framework/tests/profile_tests.py
> index 3a7d68b..010dbc3 100644
> --- a/framework/tests/profile_tests.py
> +++ b/framework/tests/profile_tests.py
> @@ -31,9 +31,6 @@ from framework.tests import utils
>  from framework import grouptools, dmesg, profile, exceptions, options
>  from framework.test import GleanTest
>  
> -# Don't print sys.stderr to the console
> -sys.stderr = sys.stdout
> -
>  
>  @utils.no_error
>  def test_initialize_testprofile():
> diff --git a/framework/tests/run_parser_tests.py b/framework/tests/run_parser_tests.py
> index 5f0b21b..677adfc 100644
> --- a/framework/tests/run_parser_tests.py
> +++ b/framework/tests/run_parser_tests.py
> @@ -156,11 +156,6 @@ class TestBackend(_Helpers):
>          self._unset_config()
>          self._move_piglit_conf()
>  
> -        # This has sideffects, it shouldn't effect anything in this module, but
> -        # it may cause later problems. But without this we get ugly error spew
> -        # from this test.
> -        sys.stderr = open(os.devnull, 'w')
> -
>          with utils.tempdir() as tdir:
>              with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
>                  f.write('[core]\nbackend=foobar')
> @@ -249,11 +244,6 @@ class TestPlatform(_Helpers):
>          self._unset_config()
>          self._move_piglit_conf()
>  
> -        # This has sideffects, it shouldn't effect anything in this module, but
> -        # it may cause later problems. But without this we get ugly error spew
> -        # from this test.
> -        sys.stderr = open(os.devnull, 'w')
> -
>          with utils.tempdir() as tdir:
>              with open(os.path.join(tdir, 'piglit.conf'), 'w') as f:
>                  f.write('[core]\nplatform=foobar')
> -- 
> 2.5.0
> 

Nose will print stdout when the test fails or errors, but not when it
passes. Printing stderr when it's expected is ugly and misleading.

Dylan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20151208/34185346/attachment.sig>


More information about the Piglit mailing list