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

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>
9 jobs for for_testrunner_1 in 0 seconds
Status Job ID Name Coverage
  External
passed ERP5.CodingStyleTest-Master

00:56:11

passed ERP5.CodingStyleTest-TestRunner1

00:58:43

failed ERP5.PerformanceTest-Master

00:35:18

failed ERP5.PerformanceTest-TestRunner1

00:34:44

failed ERP5.UnitTest-Master

02:47:30

passed ERP5.UnitTest-TestRunner1

01:59:59

passed SlapOS.Eggs.UnitTest-Master.Python2

00:23:46

passed SlapOS.Eggs.UnitTest-Master.Python3

00:27:03

passed Wendelin.UnitTest-Master

00:34:17