Dan Kenigsberg has submitted this change and it was merged.

Change subject: tests: janitorial: factor named temp file creation
......................................................................


tests: janitorial: factor named temp file creation

A common pattern in the testsuite is to create a named
temporary entry in the filesystem, optionally filled
with test data and, less commonly,  with adjusted permissions.

This patch refactor this behaviour in an handy context manager,
named temporaryPath, which also ensures entries are deleted when
no longer needed.

It is worth to point out that the usage of this context manager
can be at least partially replaced with tempfile.NamedTemporyPath;
If it's the case, this will be addressed in a future patch.

PatchSet V2:
- fix rebasing

PatchSet V3:
- always cleanup the temporary path, even in presence of exceptions.

Change-Id: Iddfb6b74f0792e234d58549c6da8fb2ddb5e72fd
Signed-off-by: Francesco Romani <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/22379
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M tests/fileUtilTests.py
M tests/miscTests.py
M tests/testrunner.py
3 files changed, 79 insertions(+), 111 deletions(-)

Approvals:
  Dan Kenigsberg: Looks good to me, approved
  Francesco Romani: Verified



-- 
To view, visit http://gerrit.ovirt.org/22379
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iddfb6b74f0792e234d58549c6da8fb2ddb5e72fd
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to