Use a BytesIO instead of a file to allow to have a one-liner and avoid that the file remains opened
(path)
| 26 | |
| 27 | |
| 28 | def get_file(path): |
| 29 | """Use a BytesIO instead of a file to allow |
| 30 | to have a one-liner and avoid that the file remains opened""" |
| 31 | bytes_io = BytesIO() |
| 32 | with open(path, "rb") as f: |
| 33 | bytes_io.write(f.read()) |
| 34 | bytes_io.seek(0) |
| 35 | return bytes_io |
| 36 | |
| 37 | |
| 38 | class TestFileField(MongoDBTestCase): |
no test coverage detected