Commit 09f5ba7247222c8e7306243312b50dc5da8156d2
1 parent
bd22902a
Append extension to filename for temporary files
Closes #45.
Showing
1 changed file
with
2 additions
and
1 deletions
@@ -12,7 +12,8 @@ fake_en = Factory.create() | @@ -12,7 +12,8 @@ fake_en = Factory.create() | ||
12 | 12 | ||
13 | def create_fake_doc(): | 13 | def create_fake_doc(): |
14 | content = fake.text() | 14 | content = fake.text() |
15 | - tf = NamedTemporaryFile(delete=False) | 15 | + suffix = fake.random_element(('.txt', '.doc', '.docx', '.pdf')) |
16 | + tf = NamedTemporaryFile(delete=False, suffix=suffix) | ||
16 | tf.write(content) | 17 | tf.write(content) |
17 | tf.close() | 18 | tf.close() |
18 | return tf.name | 19 | return tf.name |
Please
register
or
login
to post a comment