From 9957d736a676d025159ba08225366d80a0eef347 2017-01-12 13:06:48 From: Thomas Kluyver Date: 2017-01-12 13:06:48 Subject: [PATCH] Fix tests for Python 2 --- diff --git a/IPython/testing/tools.py b/IPython/testing/tools.py index 6391133..36cb102 100644 --- a/IPython/testing/tools.py +++ b/IPython/testing/tools.py @@ -18,7 +18,11 @@ import tempfile from contextlib import contextmanager from io import StringIO from subprocess import Popen, PIPE -from unittest.mock import patch +try: + from unittest.mock import patch +except ImportError: + # Python 2 compatibility + from mock import patch try: # These tools are used by parts of the runtime, so we make the nose