summaryrefslogtreecommitdiff
blob: 9bc22e091918e3516224bc6e3539217a722b0e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/oct2py/ipython/tests/test_octavemagic.py b/oct2py/ipython/tests/test_octavemagic.py
index b75d992..43c0a8b 100644
--- a/oct2py/ipython/tests/test_octavemagic.py
+++ b/oct2py/ipython/tests/test_octavemagic.py
@@ -1,5 +1,6 @@
 """Tests for Octave magics extension."""
 
+import codecs
 import unittest
 import sys
 from IPython.testing.globalipapp import get_ipython
@@ -22,7 +23,8 @@ class OctaveMagicTest(unittest.TestCase):
         IPython team's logic.
         '''
         if not sys.stdin.encoding:
-            sys.stdin.encoding = 'utf-8'  # needed for py.test
+            # needed for py.test
+            sys.stdin = codecs.getreader('utf-8')(sys.stdin)
         cls.ip = get_ipython()
         # This is just to get a minimally modified version of the changes
         # working