|
From: Erlend V <eb...@im...> - 2001-01-15 16:58:56
|
Hi all!
I'm trying to look into using Jython with JUnit
in my Class that extends junit.framework.TestCase, i have
def suite():
"@sig public static junit.framework.Test suite()"
print "suite called"
return junit.framework.TestSuite("test.SimpleTest")
If I dont specify the "@sig", the static suite method is not overridden, and
if I add the @sig, I get the problem shown below.
How can a Jython program override a static method?
Erlend
------
[evb@evb unittest]$ jythonc -p test SimpleTest.py
processing SimpleTest
Required packages:
junit.swingui
junit.framework
Creating adapters:
Creating .java files:
SimpleTest module
SimpleTest extends junit.framework.TestCase
Compiling .java to .class...
Compiling with args: ['/usr/local/ibmjdk1.3/bin/javac', '-classpath',
'/usr/local/jython-2.0b2/jython.jar:.::/usr/local/ant/ant/lib/ant.jar:/usr/local/JacORB1_1/classes:/usr/local/JacORB1_1/lib/idl.jar:/usr/local/JacORB1_1/lib/jacorb.jar:/usr/local/jython-2.0b2/jython.jar:/usr/local/junit3.4/junit.jar:./jpywork::/usr/local/jython-2.0b2/Tools/jythonc:/home/evb/work/python/unittest/.:/usr/local/jython-2.0b2/Lib',
'./jpywork/test/SimpleTest.java']
1 ./jpywork/test/SimpleTest.java:158: non-static variable this cannot be
referenced from a static context
PyObject inst = Py.jgetattr(this, "suite");
^
Note: ./jpywork/test/SimpleTest.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
1 error
ERROR DURING JAVA COMPILATION... EXITING
|