Run java test in IDE

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Run java test in IDE

Isaiah Peng
Hi Guys,

When run the java tests with intellij, it failsĀ  initialize the PySystemState in the setup phrase, digged a bit, I think that the exposed types are not correctly instrumented. The same test runs with the ant task:

ant singlejavatest -DExposedTypeProcessorTest

I've added the `ant expose` task to intellij run configuration, but it doesn't make any difference.

Not sure if it is even possible to run the tests in IDE, do you have any suggestions?

Best,
Isaiah

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev
Reply | Threaded
Open this post in threaded view
|

Re: Run java test in IDE

Jeff Allen-2
Hi Isaiah,

I'm using Eclipse (and mostly on Windows), so this is likely to be
different for you, however ...

Jython-the-program has always run very badly for me under the IDE: I
just don't seem to be able to give it the environment it needs, and
console I/O is a basket case. I always run Jython at the command prompt.
If I need to single-step the code, I use remote debugging.

JUnit tests, on the other hand, work brilliantly under the IDE,
including debugging. The only niggle I commonly encounter is that to
raise a PyException I have to create an instance of the interpreter
(static PythonInterpreter interp = new PythonInterpreter(); ) in my test
fixture.

Finding the built-in types uninitialised is, for me, a symptom of having
the build path in the wrong order. In some circumstances (debugging
exposed classes, and between "clean" and "build", I think) one has to
have the ~/src directory first, but this then means that when loading
classes, the JVM finds the unexposed version of the class instead of the
exposed one -- not that ~/src contains any classes, but I think Eclipse
helpfully finds them. So mostly I have the ~/exposed directory first,
and ensure "expose" has run on the latest source.

Now if you're actually testing the exposer ... that seems likely to add
a whole new layer of confusion, but I hope some of the above helps.

Jeff

Jeff Allen

On 08/07/2016 10:15, Isaiah Peng wrote:

> Hi Guys,
>
> When run the java tests with intellij, it fails  initialize the
> PySystemState in the setup phrase, digged a bit, I think that the
> exposed types are not correctly instrumented. The same test runs with
> the ant task:
>
> ant singlejavatest -DExposedTypeProcessorTest
>
> I've added the `ant expose` task to intellij run configuration, but it
> doesn't make any difference.
>
> Not sure if it is even possible to run the tests in IDE, do you have
> any suggestions?
>
> Best,
> Isaiah
>


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev
Reply | Threaded
Open this post in threaded view
|

Re: Run java test in IDE

Isaiah Peng
Hi Jeff,

Thanks for the hint, indeed the initialize error is gone once I added the `build/exposed` (the default path in which exposed .class files are dumped) path to intellij as `resource`, now I got a different error but I think it's somehow related to configuration of environment you mentioned above.

I am working on exposing the builtin modules in a similar way as the builtin types, so that they can be proper modules in Python. Currently they are 'type` and the module functions are reflected.

Cheers,
Isaiah

On Mon, 11 Jul 2016 at 11:08 Jeff Allen <[hidden email]> wrote:
Hi Isaiah,

I'm using Eclipse (and mostly on Windows), so this is likely to be
different for you, however ...

Jython-the-program has always run very badly for me under the IDE: I
just don't seem to be able to give it the environment it needs, and
console I/O is a basket case. I always run Jython at the command prompt.
If I need to single-step the code, I use remote debugging.

JUnit tests, on the other hand, work brilliantly under the IDE,
including debugging. The only niggle I commonly encounter is that to
raise a PyException I have to create an instance of the interpreter
(static PythonInterpreter interp = new PythonInterpreter(); ) in my test
fixture.

Finding the built-in types uninitialised is, for me, a symptom of having
the build path in the wrong order. In some circumstances (debugging
exposed classes, and between "clean" and "build", I think) one has to
have the ~/src directory first, but this then means that when loading
classes, the JVM finds the unexposed version of the class instead of the
exposed one -- not that ~/src contains any classes, but I think Eclipse
helpfully finds them. So mostly I have the ~/exposed directory first,
and ensure "expose" has run on the latest source.

Now if you're actually testing the exposer ... that seems likely to add
a whole new layer of confusion, but I hope some of the above helps.

Jeff

Jeff Allen

On 08/07/2016 10:15, Isaiah Peng wrote:
> Hi Guys,
>
> When run the java tests with intellij, it failsĀ  initialize the
> PySystemState in the setup phrase, digged a bit, I think that the
> exposed types are not correctly instrumented. The same test runs with
> the ant task:
>
> ant singlejavatest -DExposedTypeProcessorTest
>
> I've added the `ant expose` task to intellij run configuration, but it
> doesn't make any difference.
>
> Not sure if it is even possible to run the tests in IDE, do you have
> any suggestions?
>
> Best,
> Isaiah
>


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Jython-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-dev