Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Write tests output to stdout
Browse files Browse the repository at this point in the history
This allows to watch test progress, in color.

Change-Id: I7ceebddae420d7d942f70a6b74ee0a3d11cf105e
Refs: bug #1187912
  • Loading branch information
iv-m committed Jun 21, 2013
1 parent 86956ba commit 8e0b333
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions anvil/components/base_testing.py
Expand Up @@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import os
import sys

from anvil import cfg
from anvil import colorizer
Expand Down Expand Up @@ -131,13 +131,11 @@ def run_tests(self):
return
cmd = self._get_test_command()
env = self._get_env()
with open(os.devnull, 'wb') as null_fh:
if self.get_bool_option("verbose", default_value=False):
null_fh = None
try:
sh.execute(cmd, stdout_fh=None, stderr_fh=null_fh, cwd=app_dir, env_overrides=env)
except excp.ProcessExecutionError as e:
if self.get_bool_option("ignore-test-failures", default_value=False):
LOG.warn("Ignoring test failure of component %s: %s", colorizer.quote(self.name), e)
else:
raise e
try:
sh.execute(cmd, stdout_fh=sys.stdout, stderr_fh=sys.stdout,
cwd=app_dir, env_overrides=env)
except excp.ProcessExecutionError as e:
if self.get_bool_option("ignore-test-failures", default_value=False):
LOG.warn("Ignoring test failure of component %s: %s", colorizer.quote(self.name), e)
else:
raise e

0 comments on commit 8e0b333

Please sign in to comment.