Use newline='' to avoid automatic newline translation
diff --git a/testing/util.py b/testing/util.py
index 3b90631..eacb637 100644
--- a/testing/util.py
+++ b/testing/util.py
@@ -25,5 +25,5 @@
 
 def write_file(filename, contents):
     """Hax because coveragepy chokes on nested context managers."""
-    with io.open(filename, 'w') as file_obj:
+    with io.open(filename, 'w', newline='') as file_obj:
         file_obj.write(contents)