~ubuntu-branches/debian/sid/mayavi2/sid

« back to all changes in this revision

Viewing changes to integrationtests/mayavi/common.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2009-03-27 04:34:55 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090327043455-vs6ox32daj6ndw33
Tags: 3.2.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
import os.path
9
9
import sys
10
10
import logging
 
11
import traceback
11
12
from optparse import OptionParser
12
13
 
13
14
# Enthought library imports
363
364
        run the test."""
364
365
 
365
366
        # Calls the users test code.
366
 
        self.do()
 
367
        try:
 
368
            self.do()
 
369
        except Exception, e:
 
370
            # To mimic behavior of unittest.
 
371
            sys.stderr.write('\nfailures=1\n')
 
372
            type, value, tb = sys.exc_info()
 
373
            info = traceback.extract_tb(tb)
 
374
            filename, lineno, function, text = info[-1] # last line only
 
375
            exc_msg = "%s\nIn %s:%d\n%s: %s (in %s)" %\
 
376
                      ('Exception', filename, lineno, type.__name__, str(value),
 
377
                       function)
 
378
            sys.stderr.write(exc_msg + '\n')
 
379
            # Log the message.
 
380
            logger.exception(exc_msg)
 
381
            if not self.interact:
 
382
                sys.exit(1)
 
383
 
367
384
        if not self.interact:
368
385
            if self.standalone:
369
386
                # Close all existing viewers.