Added cleanup function to the screeshot testcase. This makes use of
the new "sharedmod" module.
---
WARNING: don't push this before the patch with sharedmod is pushed in
the repo, otherwise this will not work. Thanks.
repos/domain/screenshot.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index 3e727a7..5a12c4b 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -6,6 +6,7 @@ import os
import mimetypes
import libvirt
+import sharedmod
required_params = ('guestname', 'filename',)
optional_params = ('screen',)
@@ -36,6 +37,7 @@ def screenshot(params):
logger.debug('Mimetype of the file is %s' % mime)
ret = st.finish()
+ sharedmod.dict['screenshot_filename'] = filename
finally:
# Some error occurred, cleanup
@@ -43,3 +45,7 @@ def screenshot(params):
conn.close()
return ret
+
+def cleanup(params):
+ if sharedmod.has_key('screenshot_filename'):
+ os.remove(sharedmod['screenshot_filename'])
--
1.7.8.5