Repository: ipython/ipython

Issue:
Skip ipc tests on Windows
There's one failure, and a couple of other errors dumped in the test log, because ZMQ's ipc transport requires Unix-y systems.

```
======================================================================
ERROR: test_ipc_cinfo (IPython.kernel.tests.test_multikernelmanager.TestKernelManager)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "S:\Users\slave\Jenkins\shiningpanda\jobs\d5f643a2\virtualenvs\ff035a1d\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\kernel\tests\test_multikernelmanager.py", line 79, in test_ipc_cinfo
    self._run_cinfo(km, 'ipc', 'test')
  File "S:\Users\slave\Jenkins\shiningpanda\jobs\d5f643a2\virtualenvs\ff035a1d\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\kernel\tests\test_multikernelmanager.py", line 54, in _run_cinfo
    stream = km.create_iopub_stream(kid)
  File "S:\Users\slave\Jenkins\shiningpanda\jobs\d5f643a2\virtualenvs\ff035a1d\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\kernel\multikernelmanager.py", line 226, in create_iopub_stream
    iopub_stream = self._create_connected_stream(kernel_id, zmq.SUB, 'iopub')
  File "S:\Users\slave\Jenkins\shiningpanda\jobs\d5f643a2\virtualenvs\ff035a1d\lib\site-packages\ipython-0.14.dev-py2.7.egg\IPython\kernel\multikernelmanager.py", line 211, in _create_connected_stream
    sock.connect(url)
  File "socket.pyx", line 493, in zmq.core.socket.Socket.connect (zmq\core\socket.c:4960)
ZMQError: Protocol not supported
```

https://jenkins.shiningpanda-ci.com/ipython/job/ipython-win-py27/39/console



Discussion:
I would fix this myself, but I'm not sure which tests should be skipped on Windows. [The relevant file](https://github.com/ipython/ipython/blob/master/IPython/kernel/tests/test_multikernelmanager.py#L63) currently has a Windows skip on `test_tcp_cinfo`, which I'm not sure of the reason for, but not on `test_tcp_lifecycle`, `test_ipc_lifecycle` or `test_ipc_cinfo`.

It should be on all test_ipc anything (zmq ipc simply doesn't exist in Windows).  I don't know how I missed these, I thought I remembered fixing them.  I'll do it tomorrow when I have a Windows VM to confirm that everything that should be skipped is.


Resolving patch:
diff --git a/IPython/kernel/kernelmanager.py b/IPython/kernel/kernelmanager.py
--- a/IPython/kernel/kernelmanager.py
+++ b/IPython/kernel/kernelmanager.py
@@ -849,7 +849,7 @@ def cleanup_connection_file(self):
             self._connection_file_written = False
             try:
                 os.remove(self.connection_file)
-            except (IOError, OSError):
+            except (IOError, OSError, AttributeError):
                 pass
     
     def cleanup_ipc_files(self):


Test patch:
diff --git a/IPython/kernel/tests/test_multikernelmanager.py b/IPython/kernel/tests/test_multikernelmanager.py
--- a/IPython/kernel/tests/test_multikernelmanager.py
+++ b/IPython/kernel/tests/test_multikernelmanager.py
@@ -65,15 +65,16 @@ def test_tcp_lifecycle(self):
         km = self._get_tcp_km()
         self._run_lifecycle(km)
     
-    @dec.skip_win32
     def test_tcp_cinfo(self):
         km = self._get_tcp_km()
         self._run_cinfo(km, 'tcp', LOCALHOST)
 
+    @dec.skip_win32
     def test_ipc_lifecycle(self):
         km = self._get_ipc_km()
         self._run_lifecycle(km)
     
+    @dec.skip_win32
     def test_ipc_cinfo(self):
         km = self._get_ipc_km()
         self._run_cinfo(km, 'ipc', 'test')