[New-bugs-announce] [issue12824] Make the write_file() helper function in test_shutil return the file name it wrote to

Hynek Schlawack report at bugs.python.org
Tue Aug 23 10:31:36 CEST 2011


New submission from Hynek Schlawack <hs at ox.cx>:

test_shutil contains a handy helper function called write_file(filename. contents). If *filename* is a tuple, os.path.join() is used to concatenate it to a path.

To be really useful, the resulting file name should be returned, so the user can work with it.

So instead of:
fn = os.path.join(x,y)
write_file(fn, 'contents')

I'd prefer:
fn = write_file((x,y), 'contents')

I have attached a simple patch that achieves this and also applied the resulting simplification to some of the tests.

----------
components: Tests
files: write_file_returns_filename.diff
keywords: patch
messages: 142795
nosy: eric.araujo, hynek
priority: normal
severity: normal
status: open
title: Make the write_file() helper function in test_shutil return the file name it wrote to
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file23014/write_file_returns_filename.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12824>
_______________________________________


More information about the New-bugs-announce mailing list