##// END OF EJS Templates
Fixing a nasty bug in test_frontend.py that was leading to all sorts...
Fixing a nasty bug in test_frontend.py that was leading to all sorts of weird problems with our test suite like random test errors and unhandled errors in Deferreds. There are 3 problems with this test module: 1. Doesn't use twisted.trial.unittest.TestCase as a base class 2. Test methods don't return Deferreds 3. One test method actually has an unhandled error in a Deferred The only thing I have don't is put a @skip decorator on test_error_callback_added_to_execute to hide 3. All of these things still need to be fixed though. But our tests now pass.

File last commit:

r1332:9a4b350a
r1614:9dcfcfc5
Show More
testTEMPLATE.py
66 lines | 2.5 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
# encoding: utf-8
"""Simple template for unit tests.
This file should be renamed to
test_FEATURE.py
so that it is recognized by the overall test driver (Twisted's 'trial'), which
looks for all test_*.py files in the current directory to extract tests from
them.
"""
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2005 Fernando Perez <fperez@colorado.edu>
# Brian E Granger <ellisonbg@gmail.com>
# Benjamin Ragan-Kelley <benjaminrk@gmail.com>
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------
from IPython.testing import tcommon
from IPython.testing.tcommon import *
#-------------------------------------------------------------------------------
# Setup for inline and standalone doctests
#-------------------------------------------------------------------------------
# If you have standalone doctests in a separate file, set their names in the
# dt_files variable (as a single string or a list thereof). The mkPath call
# forms an absolute path based on the current file, it is not needed if you
# provide the full pahts.
dt_files = fullPath(__file__,[])
# If you have any modules whose docstrings should be scanned for embedded tests
# as examples accorging to standard doctest practice, set them here (as a
# single string or a list thereof):
dt_modules = []
#-------------------------------------------------------------------------------
# Regular Unittests
#-------------------------------------------------------------------------------
class FooTestCase(unittest.TestCase):
def test_foo(self):
pass
#-------------------------------------------------------------------------------
# Regular Unittests
#-------------------------------------------------------------------------------
# This ensures that the code will run either standalone as a script, or that it
# can be picked up by Twisted's `trial` test wrapper to run all the tests.
if tcommon.pexpect is not None:
if __name__ == '__main__':
unittest.main(testLoader=IPDocTestLoader(dt_files,dt_modules))
else:
testSuite = lambda : makeTestSuite(__name__,dt_files,dt_modules)