Commit af892b0b authored by Jason Madden's avatar Jason Madden

Add (hopefully) failing (on windows) test for #1282

parent d221b203
...@@ -3,6 +3,7 @@ import os ...@@ -3,6 +3,7 @@ import os
import sys import sys
import tempfile import tempfile
import gc import gc
import unittest
import gevent import gevent
from gevent.fileobject import FileObject, FileObjectThread from gevent.fileobject import FileObject, FileObjectThread
...@@ -172,5 +173,26 @@ def writer(fobj, line): ...@@ -172,5 +173,26 @@ def writer(fobj, line):
fobj.close() fobj.close()
class TestTextMode(unittest.TestCase):
def test_default_mode_writes_linesep(self):
# See https://github.com/gevent/gevent/issues/1282
# libuv 1.x interferes with the default line mode on
# Windows.
fileno, path = tempfile.mkstemp('.gevent.test__fileobject.test_default')
self.addCleanup(os.remove, path)
os.close(fileno)
with open(path, "w") as f:
f.write("\n")
with open(path, "rb") as f:
data = f.read()
self.assertEqual(data, os.linesep.encode('ascii'))
if __name__ == '__main__': if __name__ == '__main__':
greentest.main() greentest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment