test_magic.test_obj_del fails on win32 #59

Closed
ipython opened this Issue May 10, 2010 · 8 comments

Comments

Projects
None yet
4 participants
@ghost

ghost commented May 10, 2010

Original Launchpad bug 366334: https://bugs.launchpad.net/ipython/+bug/366334
Reported by: ellisonbg (Brian Granger).

test_obj_del fails on win32 because getoutput is called like this:

IP.getoutput('ipython obj_del.py')

But on Windows, the ipython executable is not found. This causes stdout to be empty
and stderr to have an error saying that ipython can't be found.

FAIL: Test that object's del methods are called on exit.

Traceback (most recent call last):
File "c:\python24\lib\site-packages\nose-0.10.4-py2.4.egg\nose\case.py", line 182, in runTest
self.test(*self.arg)
File "c:\python24\external\ipython\IPython\tests\test_magic.py", line 86, in test_obj_del
nt.assert_equals(out,'obj_del.py: object A deleted')
AssertionError: '' != 'obj_del.py: object A deleted'

raise self.failureException,
(None or '%r != %r' % ('', 'obj_del.py: object A deleted'))


@ghost

ghost commented May 10, 2010

[ LP comment 1 by: Brian Granger, on 2009-04-24 22:56:21.616906+00:00 ]

We are now finding ipython using platutils.find_cmd, but we still see this error.

@ghost

ghost commented May 10, 2010

[ LP comment 2 by: Brian Granger, on 2009-04-25 22:24:37.298541+00:00 ]

Here is an IPython session showing this bug:

In [4]: from IPython.platutils import find_cmd

In [5]: from IPython.platutils import get_long_path_name

In [6]: cmd = find_cmd('ipython')

In [7]: cmd
Out[7]: 'C:\Python25\Scripts\ipython.exe'

In [8]: _ip.IP.getout
_ip.IP.getoutput _ip.IP.getoutputerror

In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
Out[8]: ''

In [9]: _ip.IP.getoutput('ipython obj_del.py')
Out[9]: ''

I spent some time looking around and getoutput uses genutils.getoutput, which uses os.popen. The odd thing is when I use os.popen3, to get the stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard. :-(

@ghost

ghost commented May 10, 2010

[ LP comment 3 by: Jörgen Stenarson, on 2009-04-26 08:10:57+00:00 ]

Brian Granger skrev:

Here is an IPython session showing this bug:

In [4]: from IPython.platutils import find_cmd

In [5]: from IPython.platutils import get_long_path_name

In [6]: cmd = find_cmd('ipython')

In [7]: cmd
Out[7]: 'C:\Python25\Scripts\ipython.exe'
This exe file is some easy_install magic which has caused me some
problems before. Why not try to do a call to python ipython.py instead?

In [8]: _ip.IP.getout
_ip.IP.getoutput _ip.IP.getoutputerror

In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
Out[8]: ''

In [9]: _ip.IP.getoutput('ipython obj_del.py')
Out[9]: ''

I spent some time looking around and getoutput uses genutils.getoutput,
which uses os.popen. The odd thing is when I use os.popen3, to get the
stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard.
:-(
This crash may be related to the problem I have seen with ipython.exe
before. There have been some threads on the lists about this problem
before. Basically the ipython.exe launches a new process that starts a
python process that runs ipython. But the original process still sees
any ctrl-c action you do and shuts down. My recomendation is to not use
ipython.exe at all.

/Jörgen

@ghost

ghost commented May 10, 2010

[ LP comment 4 by: Brian Granger, on 2009-04-27 20:57:20+00:00 ]

Ahh, that may be it. I will give this a shot.

Brian

On Sun, Apr 26, 2009 at 1:10 AM, Jörgen Stenarson
jorgen.stenarson@bostream.nu wrote:

Brian Granger skrev:

Here is an IPython session showing this bug:

In [4]: from IPython.platutils import find_cmd

In [5]: from IPython.platutils import get_long_path_name

In [6]: cmd = find_cmd('ipython')

In [7]: cmd
Out[7]: 'C:\Python25\Scripts\ipython.exe'
This exe file is some easy_install magic which has caused me some
problems before. Why not try to do a call to python ipython.py instead?

In [8]: _ip.IP.getout
_ip.IP.getoutput      _ip.IP.getoutputerror

In [8]: _ip.IP.getoutput(cmd+' obj_del.py')
Out[8]: ''

In [9]: _ip.IP.getoutput('ipython obj_del.py')
Out[9]: ''

I spent some time looking around and getoutput uses genutils.getoutput,
which uses os.popen.  The odd thing is when I use os.popen3, to get the
stderr, it hangs and when I use CTRL-C to abort, IPython crashes hard.
:-(
This crash may be related to the problem I have seen with ipython.exe
before. There have been some threads on the lists about this problem
before. Basically the ipython.exe launches a new process that starts a
python process that runs ipython. But the original process still sees
any ctrl-c action you do and shuts down. My recomendation is to not use
ipython.exe at all.

/Jörgen

test_magic.test_obj_del fails on win32
https://bugs.launchpad.net/bugs/366334
You received this bug notification because you are a member of IPython
Developers, which is subscribed to IPython.

Status in IPython - Enhanced Interactive Python: Confirmed

Bug description:
test_obj_del fails on win32 because getoutput is called like this:

IP.getoutput('ipython obj_del.py')

But on Windows, the ipython executable is not found.  This causes stdout to be empty
and stderr to have an error saying that ipython can't be found.

FAIL: Test that object's del methods are called on exit.

Traceback (most recent call last):
 File "c:\python24\lib\site-packages\nose-0.10.4-py2.4.egg\nose\case.py", line 182, in runTest
   self.test(*self.arg)
 File "c:\python24\external\ipython\IPython\tests\test_magic.py", line 86, in test_obj_del
   nt.assert_equals(out,'obj_del.py: object A deleted')
AssertionError: '' != 'obj_del.py: object A deleted'

raise self.failureException,
         (None or '%r != %r' % ('', 'obj_del.py: object A deleted'))


Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger@calpoly.edu
ellisonbg@gmail.com

Owner

fperez commented Apr 8, 2011

@jstenar, can you see if this problem still exists?

Owner

minrk commented May 17, 2011

This test is currently skipped on Windows, but letting it run, it does pass for me. The neighboring test_tclass that is also skipped in Windows still fails.

It does depend on win32api, so it still needs that conditional on it.

Owner

takluyver commented May 29, 2011

If this is passing on Windows now, can we remove the skip_win32 decorator and close the issue? If test_tclass still fails, should we leave this issue open for it, or start a new one?

Owner

fperez commented May 29, 2011

@takluyver, I'd remove the deco, close this one, and open a clean one for tclass if that fails, simply with a link to this one in there in case it's useful to read some of this discussion when thinking about the tclass one.

takluyver closed this in 22a3c9a May 29, 2011

@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

@takluyver takluyver IPython.core.tests.test_run.test_obj_del apparently no longer fails o…
…n Windows, so we don't need to skip it.

Closes gh-59
286f4a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment