From: Jason Dillon <jason@pl...> - 2001-12-22 05:39:58
A little background... I am tring to setup an environment where I can use
Jython with JUnit to test Java systems. I also didn't want to loose the
ability to use pure java tests and wanted to make use of the current Ant
tasks to run the tests and generate reports.
From the first glance it looks like jythonc is exactly what I want... and
well it sort of works, but it is very touchy about what it can do. I had
things working, then broke it by a minor change (which didn't affect the
running of the .py's), spent hours finding out what was wrong... then did
the same thing all over again.
So, I have overcome the hurdle of having a Jython class extend from
junit.framework.TestCase, and pass its name in the constructor (for both
compiled and interpreted use).
The problem I am running into now, is that I moved some of the support bits
that allow the above to work into a support.py module... well that isn't
what actually caused the problem, the actual problem was when I tried using
a package to better organize tests.
What I have is something like this:
I am setting -Dpython.path=src/py and running jythonc with arguments like:
jythonc --deep --package my.package.pytest --workdir output/jpywork --falsenames ENABLE_SUPER_CLASS_INIT support command.executor
Which produces output like this:
Creating .java files:
AbstractTestCase extends junit.framework.TestCase
So far so good... until I try to startup the test runner. I get a
"ImportError: no module named support" exception when running.
I have found that if I copy src/py/support.py to src/py/command, re-compile
specifing command.support and run that it works.
So I am wondering why it can't find the support module when it is in its
I tried playing around with looking it up with the full java package name,
but ran into problems with the 'pytest' module, which did not exist.
* * *
This is really close to working, but I would rather not have to duplicate
support.py or maintain a flat namespace for tests. I would like to avoid
having to write JUnit in Java though (way to much work)... so I have to
figure something out.
I was going to try setting up the full java package structure in src/py, but
I don't know if that will work. I did try omitting the packagname, but ran
into odd compile problems in some circumstances, and yet it worked in
others. This seems very tempermental. Can some one help me understand what
I need to tame this beast?