Re: [test-API PATCH] Added screenshot test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/04/2012 07:53 PM, Martin Kletzander wrote:
On 04/04/2012 01:23 PM, Guannan Ren wrote:
On 04/04/2012 06:30 PM, Martin Kletzander wrote:
On 04/04/2012 07:13 AM, Guannan Ren wrote:
---
   repos/domain/screenshot.py |    5 +++++
   1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index 9986cab..eeda2b5 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -55,3 +55,8 @@ def screenshot(params):
               conn.close()

       return ret
+
+def screenshot_clean(params):
+    """clean testing environment"""
+    filename = params['filename']
+    os.system('rm -f %s.*' % filename)
The extension can be different every time, so we have to check that. I'd
prefer something like this:

diff --git a/repos/domain/screenshot.py b/repos/domain/screenshot.py
index 9986cab..c620085 100644
--- a/repos/domain/screenshot.py
+++ b/repos/domain/screenshot.py
@@ -39,8 +39,8 @@ def screenshot(params):
           st = conn.newStream(0)
           mime = dom.screenshot(st, params['screen'], 0)

-        ext = mimetypes.guess_extension(mime) or '.ppm'
-        filename = params['filename'] + ext
+        params['ext'] = mimetypes.guess_extension(mime) or '.ppm'

                  This modification on params couldn't be passed in
screenshot_clean()
                  The params to screenshot_clean() is the same as the
screenshot() which
                  is from testcase config file.


Darn :( That's exactly why I wanted the parameter passing between tests
:) What do you suggest? Should I save the extension into another file or
do we have any other option?

The idea to share variable is reasonable, we can create a shared_mod.py in root of test-API, then import it in all of testcases, The first testcase put the value in this module for sharing with other modules. the connection object, domain
    network .etc could be shared in this way.
Except these fixed share object. we could define 3 or 5 customized shared variable
    for use.   The contents of shared_mod.py should be like this:

      #shared_mod.py
      con = None
      domobj = None
      netojb = None
      stgobj = None
      ...
      defined_var1 = None
      defined_var2 = None
      defined_var3 = None

     Guannan Ren

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]