File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 11# Copyright Contributors to the Pyro project.
22# SPDX-License-Identifier: Apache-2.0
33
4+ import logging
45import os
5- from subprocess import check_call
6+ from subprocess import PIPE , CalledProcessError , check_output
67import sys
78
89import pytest
8081@pytest .mark .parametrize ("example" , EXAMPLES )
8182@pytest .mark .filterwarnings ("ignore:There are not enough devices:UserWarning" )
8283@pytest .mark .filterwarnings ("ignore:Higgs is a 2.6 GB dataset:UserWarning" )
83- def test_cpu (example ):
84+ def test_cpu (request : pytest . FixtureRequest , example ):
8485 print ("Running:\n python examples/{}" .format (example ))
8586 example = example .split ()
8687 filename , args = example [0 ], example [1 :]
8788 filename = os .path .join (EXAMPLES_DIR , filename )
88- check_call ([sys .executable , filename ] + args )
89+ try :
90+ check_output ([sys .executable , filename ] + args , text = True , stderr = PIPE )
91+ except CalledProcessError as ex :
92+ logger = logging .getLogger (request .node .name )
93+ logger .error ("stdout:\n %s" , ex .stdout )
94+ logger .error ("stderr:\n %s" , ex .stderr )
95+ raise
You can’t perform that action at this time.
0 commit comments