[ptt-users] distinguishing environment in which script is being
run...
Dominique de Waleffe
dominique.dewaleffe at denali.be
Thu Sep 13 03:23:20 PDT 2007
I am writiung jython test scripts.
When they are run as functional/load test, some method is called by the
runner. Ok.
When trying out those scripts under testmaker by using the [Agent]>[Run
Script Locally] menu, I have no way to specify which method/call to
execute. The file gets loaded and whatever code is runnable is being run.
The problem is that if I put test code there, it will also be run when
the script is loaded onto a testnode, which is not what I want...
example:
-----------
class MyTest():
def setUP():
pass:
def test():
pass
def tearDown():
pass
#testing the test...
t=MyTest()
t.setUp()
for i in [1,2,3]:
t.test()
t.tearDown()
------------
So is there a check I can do to determine whether the code is loaded as
testnode code or via[Agent]>[Run Script Locally]?
so that I can use an trick like if __main__=="main": to either
allow/prevent execution of this bit of code?
Thanks,
D.
--
Dominique de Waleffe
Technical director
Denali S.A., "Bridging the gap between Business and IT"
Rue de Clairvaux 8, B-1348 Louvain-la-Neuve, Belgium
Office: +32 10 43 99 51 Fax: +32 10 43 99 52
http://www.denali.be
Legal notice: this message and its attachments may contain
confidential and/or privileged information. If you are not the
addressee or authorized to receive this for the addressee, you must
not use, copy, disclose or take any action based on this message or
any information herein. If you have received this message by mistake,
please advise the sender immediately by return e-mail and delete this
message from your system. Thank you for your cooperation.
More information about the Users
mailing list