tests: makeFileUpload: Use unittest addCleanup() to close files rather than tearDown().

This executes even if setup() encounters an error and the cleanup hook is added
when opening the file, not later on.

Also, unify makeFileUpload() and makeFilePath() to remove duplicated code.

Co-authored-by: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
6 jobs for arnau in 0 seconds
latest
Status Job ID Name Coverage
  External
passed ERP5.CodingStyleTest-TestRunner1

02:10:47

failed ERP5.PerformanceTest-TestRunner1

00:35:28

failed ERP5.UnitTest-TestRunner1

04:45:03

failed ERP5.UnitTest-TestRunner1

03:05:11

failed ERP5.UnitTest-TestRunner1

03:37:18

failed ERP5.UnitTest-TestRunner1

01:56:42