[LDTP-Dev] removecallback usage?

Wang Qi, Scott wangqi.s at gmail.com
Sun Nov 15 02:12:20 PST 2009


Hi Nagappan,

I want to make use of onwindowcreate() and removecallback() to accomplish a
usage as such:

1) I register a callback using onwindowcreate() just before I invoke a menu
operation for my application under test  (AUT).
2) Then, I invoke the menu
2.1) If the pop-up does occur, the call back is triggered.
3) After the menu operations, I remove the callback using removecallback ().
As the pop-up has a quite generic name, the action in the callback is only
meant to be valid for this particular menu.
4) Perform other operations...
5) At last, the whole test case finishes.

But in my code, at step 3) I get this exceptions as below.

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/mago/cmd/runner.py", line 95,
in run
    self._run(loggerclass, setup_once)
  File "/usr/local/lib/python2.6/dist-packages/mago/cmd/runner.py", line
122, in _run
    self.suite.setup()
  File
"/home/qwang12/tl/src/QA/AutoTest/TestCode/guiauto/ldtpsrc/trinitylake_testsuites.py",
line 78, in setup
    super(BldkDefaultConfTestSuite, self).setup()
  File
"/home/qwang12/tl/src/QA/AutoTest/TestCode/guiauto/ldtpsrc/trinitylake_testsuites.py",
line 26, in setup
    self.application.open()
  File
"/home/qwang12/tl/src/QA/AutoTest/TestCode/guiauto/ldtpsrc/trinitylake.py",
line 172, in open
    ldtp.removecallback(self.UNEXPECTED_STALL_PROJECT_DLG_TITLE)
  File "/var/lib/python-support/python2.6/ldtp.py", line 2019, in
removecallback
    _callbackFunctions [windowTitle][1].exit ()
AttributeError: 'int' object has no attribute 'exit'

I read the code in removecallback(), i save the below highlighted comments:

        if _callbackFunctions.has_key (windowTitle):
            *# Exit last thread registered with same window title*
            _callbackFunctions [windowTitle][1].exit ()
            # delete the previous instance

My question is that why to "Exit last thread" in removecallback ()?

Thanks
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/ldtp-dev/attachments/20091115/c5a35f23/attachment.html 


More information about the LDTP-dev mailing list