Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r71036:d63b49940eff Date: 2014-04-28 09:30 +0200 http://bitbucket.org/pypy/pypy/changeset/d63b49940eff/
Log: Fix the test: - make it pass (O_APPEND missing) - make it fail before the O_APPEND change diff --git a/rpython/rlib/streamio.py b/rpython/rlib/streamio.py --- a/rpython/rlib/streamio.py +++ b/rpython/rlib/streamio.py @@ -40,7 +40,7 @@ from rpython.rlib import rposix from rpython.rlib.rstring import StringBuilder -from os import O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC +from os import O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_TRUNC, O_APPEND O_BINARY = getattr(os, "O_BINARY", 0) # (basemode, plus) diff --git a/rpython/rlib/test/test_streamio.py b/rpython/rlib/test/test_streamio.py --- a/rpython/rlib/test/test_streamio.py +++ b/rpython/rlib/test/test_streamio.py @@ -1105,21 +1105,19 @@ signal(SIGALRM, SIG_DFL) def test_append_mode(self): - try: - fo = streamio.open_file_as_stream # shorthand - x = fo('.test.file', 'w') - x.write('abc123') - x.close() + tfn = str(udir.join('streamio-append-mode')) + fo = streamio.open_file_as_stream # shorthand + x = fo(tfn, 'w') + x.write('abc123') + x.close() - x = fo('.test.file', 'a') - x.write('456') - x.close() - x = fo('.test.file', 'r') - assert x.read() == 'abc123456' - x.close() - finally: - if os.path.exists('.test.file'): - os.remove('.test.file') + x = fo(tfn, 'a') + x.seek(0, 0) + x.write('456') + x.close() + x = fo(tfn, 'r') + assert x.read() == 'abc123456' + x.close() # Speed test _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit