[robotframework commit] r1262 - trunk/src/robot/running

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 12, 2009, 7:05:22 PM1/12/09
to robotframe...@googlegroups.com
Author: pekka.klarck
Date: Mon Jan 12 14:29:30 2009
New Revision: 1262

Modified:
trunk/src/robot/running/testlibraries.py

Log:
a bit more cleanup and comments

Modified: trunk/src/robot/running/testlibraries.py
==============================================================================
--- trunk/src/robot/running/testlibraries.py (original)
+++ trunk/src/robot/running/testlibraries.py Mon Jan 12 14:29:30 2009
@@ -224,34 +224,31 @@
class _ClassLibrary(_BaseTestLibrary):

def _get_handler_method(self, libcode, name):
- # Type is checked before using getattr to avoid calling
properties, most
- # importantly bean properties generated by Jython (issue 188).
+ # Type is checked before using getattr to avoid calling properties,
+ # most importantly bean properties generated by Jython (issue 188).
for item in (libcode,) + inspect.getmro(libcode.__class__):
try:
- if self._is_valid_handler(item.__dict__[name], item,
libcode):
+ if self._is_valid_handler(item.__dict__[name]):
return getattr(libcode, name)
except (KeyError, AttributeError):
- # Java classes don't always have __dict__
- pass
+ pass # Java classes don't always have __dict__
raise TypeError('Not a method or function')

- def _is_valid_handler(self, handler, handler_parent, libcode):
- "Filters methods defined in java.lang.Object or generated by
Jython."
+ def _is_valid_handler(self, handler):
if inspect.isroutine(handler):
return True
- if not utils.is_jython or not isinstance(handler,
PyReflectedFunction):
+ if not (utils.is_jython and isinstance(handler,
PyReflectedFunction)):
return False
- if handler_parent is Object:
- return False
- # signature is an instance of org.python.ReflectedArgs
+ # When we get here, the handler is created in a Java class possibly
+ # extended in Python. This code ignores handlers defined only in
+ # java.lang.Object or generated by Jython (in org.python.proxies).
for signature in handler.argslist[:handler.nargs]:
# 'getName' may raise an exception -- not sure why but that
happens
# at least with handlers declared in class extending JUnit
TestCase.
- # Would be better to investigate but just not excluding these
- # should be an ok workaround.
try:
- name = signature.declaringClass.getName()
- if not name.startswith('org.python.proxies.'):
+ cls = signature.declaringClass
+ if not (cls is Object or
+ cls.getName().startswith('org.python.proxies.')):
return True
except:
return True

Reply all
Reply to author
Forward
0 new messages