##// END OF EJS Templates
Robustness fixes in test suite machinery....
Robustness fixes in test suite machinery. Added a module-level INSTALLED flag, which can be set to false if the test suite is being run in-place (without ipython having been installed at all). This is because how we call and import things must be done differently depending on whether the code is installed or is being run in-place. The only ones that can know this reliably are the entry-point scripts, so those are responsible for setting this flag. Also made the code that validates ipython in subprocesses report errors better, by checking stderr for errors before validating stdout output, as anything on stderr will be likely informative of the real problem.

File last commit:

r2426:61e33e8e
r2494:c8938204
Show More
test_prefilter.py
34 lines | 1.1 KiB | text/x-python | PythonLexer
"""Tests for input manipulation machinery."""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import nose.tools as nt
from IPython.testing import tools as tt, decorators as dec
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
@dec.parametric
def test_prefilter():
"""Test user input conversions"""
# pairs of (raw, expected correct) input
pairs = [ ('2+2','2+2'),
('>>> 2+2','2+2'),
('>>> # This is a comment\n'
'... 2+2',
'# This is a comment\n'
'2+2'),
# Some IPython input
('In [1]: 1', '1'),
('In [2]: for i in range(5):\n'
' ...: print i,',
'for i in range(5):\n'
' print i,'),
]
ip = get_ipython()
for raw, correct in pairs:
yield nt.assert_equals(ip.prefilter(raw), correct)