diff --git a/test/test_c_execution.py b/test/test_c_execution.py
index 9d99f9b953b9cd62903c470f12417437b1a52276..d1b3c95caa034191b4b29c49076fc101cd318950 100644
--- a/test/test_c_execution.py
+++ b/test/test_c_execution.py
@@ -25,9 +25,9 @@ THE SOFTWARE.
 import numpy as np
 import loopy as lp
 import sys
+import six
 import pytest
 from loopy import CACHING_ENABLED
-from StringIO import StringIO
 
 import logging
 logger = logging.getLogger(__name__)
@@ -206,7 +206,7 @@ def test_c_caching():
                 @param newLogLevel: Optionally change the global logging level, e.g.
                 logging.DEBUG
             """
-            self.buffer = StringIO()
+            self.buffer = six.StringIO()
             self.buffer.write("Log output")
 
             logger = logging.getLogger()