[IPython-dev] Ma branche

Gael Varoquaux gael.varoquaux@normalesup....
Sun Aug 17 00:14:19 CDT 2008


On Sat, Aug 16, 2008 at 09:19:31PM -0700, Fernando Perez wrote:
> +def isolate_ipython0(func):
> +    """ Decorator to isolate execution that involves an iptyhon0.
> +    """
> +    def my_func(*args, **kwargs):
> +        ipython0 = get_ipython0().IP
> +        user_ns = ipython0.user_ns
> +        global_ns = ipython0.global_ns
> +        func(*args, **kwargs)
> +        ipython0.user_ns = user_ns
> +        ipython0.global_ns = global_ns
> +
> +    return my_func

> there should be:

> try:
>   func...
> finally:
>   restore namespaces

> so that if the test fails, the namespace handling isn't all mucked up, no?

Yup, sounds good. Code review rocks.

> Let me know when you change and I'll proceed.  Otherwise it looks OK.

I am good. However I have a test failing on my box and it doesn't seem to
be due to my code (I have running the test suite without my tests):

======================================================================
FAIL: Doctest: IPython.iplib.InteractiveShell.complete
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/usr/local/lib/python2.5/site-packages/IPython_doctest_plugin-0.1-py2.5.egg/ipdoctest.py",
line 343, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for
IPython.iplib.InteractiveShell.complete
  File "/home/varoquau/dev/ipython/ipython-frontend/IPython/iplib.py",
line 989, in complete

----------------------------------------------------------------------
File "/home/varoquau/dev/ipython/ipython-frontend/IPython/iplib.py", line
1011, in IPython.iplib.InteractiveShell.complete
Failed example:
    _ip.IP.complete('x.l')
Expected:
    ['x.ljust', 'x.lower', 'x.lstrip']
Got:
    []

>>  raise self.failureException(self.format_failure(<StringIO.StringIO
>>  instance at 0x40201c6c>.getvalue()))
    

----------------------------------------------------------------------

In addition, I have a test failing due to an import to win32api failing.

Does all this work on your box?

Gaël


More information about the IPython-dev mailing list