environment variable 'targetname'

Richard Poppe rpoppe65 at hotmail.com
Wed May 11 07:15:50 UTC 2005


Who can help me with the following (i am not familiar with python 
programming)

I would like to use the targetname in my tested program and tried to 
retrieve it with an environment variable. When i set target_name (see 
details below) as a constant the environment variable will be available, but 
when i try to use the GetName() function the environment variable does not 
appear.

I am using Win2000 with python 2.3, and made the following changes to the 
scripts:

Add TARGET_CONTEXT_PROPERTY to 
C:\Python23\Lib\site-packages\qm\test\context.py (i put it before the 
DB_PATH_CONTEXT_PROPERTY):
    TARGET_CONTEXT_PROPERTY = "qmtest.target"
    DB_PATH_CONTEXT_PROPERTY = "qmtest.dbpath"

Add TARGET_CONTEXT_PROPERTY to 
C:\Python23\Lib\site-packages\qm\test\target.py (i put it before the 
DB_PATH_CONTEXT_PROPERTY):
            #target_name = "constant"
            target_name = self.GetName()
            context[context.TARGET_CONTEXT_PROPERTY] \
                = "Target %s" % target_name
            context[context.DB_PATH_CONTEXT_PROPERTY] \
                = descriptor.GetDatabase().GetPath()

I created a target:
qmtest.py create-target ws1 thread_target.ThreadTarget group1

And i created a test that will run on that target:
<?xml version="1.0" ?>
<!DOCTYPE extension
  PUBLIC '-//QM/2.2/Extension//EN'
  'http://www.codesourcery.com/qm/dtds/2.2/-//qm/2.2/extension//en.dtd'>
<extension class="command.ExecTest" kind="test">
<argument name="stdin"><text/></argument>
<argument name="stderr"><text/></argument>
<argument name="stdout"><text/></argument>
<argument name="prerequisites"><set/></argument>
<argument name="target_group"><text>group1</text></argument>
<argument name="exit_code"><integer>0</integer></argument>
<argument name="environment"><set/></argument>
<argument name="program"><text>C:\WINNT\system32\cmd.exe </text></argument>
<argument name="arguments"><set><text>/c "set</text></set></argument>
<argument name="timeout"><integer>-1</integer></argument>
<argument name="resources"><set/></argument></extension>

After running the test (it starts a windows command box and executes the set 
command) the error details show "QMV_qmtest__target=Target constant" in case 
of the constant and nothing in case of the GetName().

Thanks in advance,
Richard.

_________________________________________________________________
Nieuw: Beeld en geluid met MSN Messenger 7.0 http://messenger.msn.nl/




More information about the qmtest mailing list