diff --git a/spyder_notebook/tests/test_plugin.py b/spyder_notebook/tests/test_plugin.py
index 457c29b2..79fb055d 100644
--- a/spyder_notebook/tests/test_plugin.py
+++ b/spyder_notebook/tests/test_plugin.py
@@ -26,6 +26,10 @@
 # Local imports
 from spyder_notebook.notebookplugin import NotebookPlugin
 
+# Python 2 compatibility
+if sys.version[0] == 2:
+    PermissionError = OSError
+
 # =============================================================================
 # Constants
 # =============================================================================