[IPython-dev] unit tests

Stefan van der Walt stefan at sun.ac.za
Fri May 25 01:46:53 EDT 2007


Hi all,

What is the preferred way of running the IPython unit tests?  In
runtests.py it says "ipython runtests.py" should work, but it throws
an exception here.

########################################################################
/home/stefan/lib/python2.5/site-packages/IPython/iplib.py in handle_normal(self, line_info)
   2110             line = ''
   2111 
-> 2112         self.log(line,line,continue_prompt)
   2113         return line
   2114 

<type 'exceptions.AttributeError'>: 'InteractiveShell' object has no attribute 'log'
########################################################################

Interestingly, when I run it using %run it actually works to some
extent, before it freezes:

########################################################################
In [2]: %run runtests.py
./test_prefilter.py
Out[3]: "\nTest which prefilter transformations get called for various input lines.\nNote that this does *not* test the transformations themselves -- it's just\nverifying that a particular combination of, e.g. config options and escape\nchars trigger the proper handle_X transform of the input line.\n\nUsage: run from the command line with *normal* python, not ipython:\n> python test_prefilter.py\n\nFairly quiet output by default.  Pass in -v to get everyone's favorite dots.\n"
------------------------------------------------------------
   File "<ipython console>", line 6
     IPython.Shell.start()
           ^
<type 'exceptions.SyntaxError'>: invalid syntax

./test_irunner.py
Out[13]: 'Test suite for the irunner module.\n\nNot the most elegant or fine-grained, but it does cover at least the bulk\nfunctionality.'
------------------------------------------------------------
   File "<ipython console>", line 42
     if __name__ == '__main__':
      ^
<type 'exceptions.SyntaxError'>: invalid syntax

./test_wildcard.py
------------------------------------------------------------
   File "<ipython console>", line 7
     root._apan=obj_t()
        ^
<type 'exceptions.SyntaxError'>: invalid syntax

./test_cd.ipy
/
/tmp
./test_ihist.ipy
Out[41]: 3
./test_shouldfail.ipy
/
./test_handlers.py
Out[46]: 'Test the various handlers which do the actual rewriting of the line.'
Out[0]: <IPython.Shell.IPShell instance at 0x8471fac>
------------------------------------------------------------
<type 'exceptions.IndentationError'>: expected an indented block (<ipython console>, line 3)

------> f2("a b c")
Out[0]: 'a b ca b c'
########################################################################

Thanks for any feedback.
Stéfan



More information about the IPython-dev mailing list