Mailing list - Entries of 2006


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

[qftestJUI] Jython module loading


  • Subject: [qftestJUI] Jython module loading
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 28 Feb 2006 10:53:42 +0100

Hi, 

I'm answering this question on the list as well as it's of general
interest.

> Hi Greg,
> 
> An easy question for you today.

Not quite so easy, but a good one.
 
> In the manual - chapter 12.4 - I can read that:
> 
> Modules that are written specifically for one
> test-suite can also be placed in the test-suite?s directory.
> 
> Can these modules be put in sub-directories of the test-suites? 

Yes, but you must put a file named __init__.py into the sub-directory
to declare the directory as a package. The file can be empty or contain
miscellaneous package initialization stuff. Then, if you have

.../suitedir
.../somesuite.qft
.../suitedir/xxx
.../suitedir/xxx/__init__.py
.../suitedir/xxx/yyy.py

In someone you can have script nodes with

import xxx.yyy

or

from xxx import yyy

> Can you also detail what happens if I modify a .py file in this
> directory. Do I need to restart QFS each time a module file is
> modified - I hope not...

Open the Jython console and execute

reload(modulename)

You can also start a script node with

import yyy
reload(yyy)

to make sure you always get the latest version. Note that reloading
will reset and module-local variables.

Best regards,
    Greg

-- 
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876



Videos Downloads Documentation Buy Free Trial