python unittest not working

Hi,

I'm running intellij 9.0.3 with Python plugin 2.5.4 and the unittest run configuration are not working.
No red flag in the Configuration UI, when I run 'Make' runs then nothing.

Any idea?

Thanks

--Gilles

17 comments

Hello Gilles,

Why are you using make instead of run action?

Regards,
Oleg

0

Hi Oleg,

I don't, the 'Make' check box is enabled by default when creating a new run configuration.
Unchecking the box makes no difference, nothing happens.

Is there any debug log somewhere? Or can I enable debug logging?

Thanks

--Gilles

0

I have the same problem, can't run my unittest python class from 9.0.3

I have unchecked Make but it has no effect. In fact, running the test does nothing at all.

0

I have the same problem, with no Make checked.  IDEA Ultimate 9.0.3, Python 2.5.2.  I cannot upgrade Python at this point so I have to find a fix.  Any developer working on this problem at all?

The error log I get behind the scene says the followings when I hit "debug" on a unit test.  "run" shows the essentially the same error.

[  79701]  ERROR - pplication.impl.LaterInvocator - com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner(Lcom/intellij/execution/process/ProcessHandler;Lcom/intellij/execution/configurations/CommandLineState;Lcom/intellij/execution/configurations/RuntimeConfiguration;Ljava/lang/String;)Lcom/intellij/execution/ui/ConsoleView;
java.lang.NoSuchMethodError: com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner(Lcom/intellij/execution/process/ProcessHandler;Lcom/intellij/execution/configurations/CommandLineState;Lcom/intellij/execution/configurations/RuntimeConfiguration;Ljava/lang/String;)Lcom/intellij/execution/ui/ConsoleView;
    at com.jetbrains.python.testing.PythonTestCommandLineStateBase.createAndAttachConsole(PythonTestCommandLineStateBase.java:45)
    at com.jetbrains.python.run.PythonCommandLineState.execute(PythonCommandLineState.java:47)
    at com.jetbrains.python.debugger.PyDebugRunner.doExecute(PyDebugRunner.java:88)
    at com.intellij.execution.runners.GenericProgramRunner$1.run(GenericProgramRunner.java:95)
    at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:80)
    at com.intellij.openapi.project.DumbService$1.run(DumbService.java:71)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:319)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
    at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:610)
    at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:500)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[  79701]  ERROR - pplication.impl.LaterInvocator - IntelliJ IDEA 9.0.3  Build #IU-95.429
[  79701]  ERROR - pplication.impl.LaterInvocator - JDK: 1.6.0_20
[  79702]  ERROR - pplication.impl.LaterInvocator - VM: Java HotSpot(TM) 64-Bit Server VM
[  79702]  ERROR - pplication.impl.LaterInvocator - Vendor: Sun Microsystems Inc.
[  79702]  ERROR - pplication.impl.LaterInvocator - OS: Linux
[  79702]  ERROR - pplication.impl.LaterInvocator - Last Action: Debug

0

Where is the error log for intellij located in Mac? Checked /Applications/IntelliJ and /Library/App Support/Intellij90 and found nothing

0

Same here :)
Sachko can you point us to where this log is?

Thanks

0

I had forgotten to mention that I'm running on Linux/Fedora.  The error messages appear in the shell where I invoke IDEA via the IDEA startup script that came with the installation (i.e. <IDEA_INSTALL_DIR>/bin/idea.sh).  Do you Mac users have any way starting IDEA from a shell?

In the meanwhile, I switched (back to) Eclipse PyDev.  I tried other free/trial IDEs such as netbeans and pycharm.  None of them, except for Eclipse, hasn't been able to pu DEBUG + unittest work together.  IDEA has this nice back-trace usages and inverse enginering features, which is hard to give up, but the lack of support on DEBUG + unittest really throws me away.  It's impossible.  Eclipse/PyDev' DEBUG+unittest works like a charm.  At least that's where I'll park until JetBrains finds solutions.

0

I found how to display the log thanks to Sachko

run /Applications/IntelliJ\ IDEA\ 9.0.3.app/Contents/MacOS/idea
from the command line

some errors:

[  10299]  ERROR - nSystem.impl.ActionManagerImpl - action with the ID "Console.Execute" was already registered. Action being registered is com.intellij.openapi.actionSystem.ActionStub@40e900; Registered action is com.intellij.openapi.actionSystem.ActionStub@de8aa5 Plugin: Python [Plugin: Pythonid]
com.intellij.diagnostic.PluginException: action with the ID "Console.Execute" was already registered. Action being registered is com.intellij.openapi.actionSystem.ActionStub@40e900; Registered action is com.intellij.openapi.actionSystem.ActionStub@de8aa5 Plugin: Python [Plugin: Pythonid]



and

[ 142190]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(506,36),absolute(868,58),button=1,modifiers=Button1,clickCount=1] on frame1
java.lang.NoSuchMethodError: com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner(Lcom/intellij/execution/process/ProcessHandler;Lcom/intellij/execution/configurations/CommandLineState;Lcom/intellij/execution/configurations/RuntimeConfiguration;Ljava/lang/String;)Lcom/intellij/execution/ui/ConsoleView;
        at com.jetbrains.python.testing.PythonTestCommandLineStateBase.createAndAttachConsole(PythonTestCommandLineStateBase.java:45)
        at com.jetbrains.python.run.PythonCommandLineState.execute(PythonCommandLineState.java:47)
        at com.jetbrains.python.run.PythonCommandLineState.execute(PythonCommandLineState.java:42)
        at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:98)
        at com.intellij.execution.runners.GenericProgramRunner$1.run(GenericProgramRunner.java:95)
        at com.intellij.execution.impl.ExecutionManagerImpl$1.run(ExecutionManagerImpl.java:129)
        at com.intellij.execution.impl.ExecutionManagerImpl.compileAndRun(ExecutionManagerImpl.java:138)
        at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:119)
        at com.intellij.execution.runners.GenericProgramRunner.execute(GenericProgramRunner.java:71)
        at com.intellij.execution.ExecutionUtil.executeConfiguration(ExecutionUtil.java:77)
        at com.intellij.execution.ExecutorRegistryImpl$ExecutorAction.actionPerformed(ExecutorRegistryImpl.java:193)
        at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:146)
        at com.intellij.openapi.actionSystem.impl.ActionButton.a(ActionButton.java:122)
        at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:282)
        at java.awt.Component.processEvent(Component.java:6113)
        at java.awt.Container.processEvent(Container.java:2085)
        at java.awt.Component.dispatchEventImpl(Component.java:4714)
        at java.awt.Container.dispatchEventImpl(Container.java:2143)
        at java.awt.Component.dispatchEvent(Component.java:4544)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4618)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4282)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4212)
        at java.awt.Container.dispatchEventImpl(Container.java:2129)
        at java.awt.Window.dispatchEventImpl(Window.java:2478)
        at java.awt.Component.dispatchEvent(Component.java:4544)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:635)
        at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:610)
        at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:496)
        at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 9.0.3  Build #IU-95.429
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.6.0_20
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) Client VM
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - Vendor: Apple Inc.
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - OS: Mac OS X
[ 142191]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: Run

0

The real source is suggested by your latter eror:
"NoSuchMethodError: com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner"

I looked for the java package but not to avail.

0

Hello Sachko,

What were the problems you've seen with debugging unittests in PyCharm?

I had forgotten to mention that I'm running on Linux/Fedora.  The
error messages appear in the shell where I invoke IDEA via the IDEA
startup script that came with the installation (i.e.
<IDEA_INSTALL_DIR>/bin/idea.sh).  Do you Mac users have any way
starting IDEA from a shell?

In the meanwhile, I switched (back to) Eclipse PyDev.  I tried other
free/trial IDEs such as netbeans and pycharm.  None of them, except
for Eclipse, hasn't been able to pu DEBUG + unittest work together.
IDEA has this nice back-trace usages and inverse enginering features,
which is hard to give up, but the lack of support on DEBUG + unittest
really throws me away.  It's impossible.  Eclipse/PyDev'
DEBUG+unittest works like a charm.  At least that's where I'll park
until JetBrains finds solutions.

---
Original message URL:
http://devnet.jetbrains.net/message/5274257#5274257


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

The problem was not really about unittest.  It was rather the lack of "import existing source code" feature.  Bang!  Right there, I stoped doing anything futher.  As you can see, I've been already working on a big code basis, and can't afford starting from scratch.  Netbeans's unittest worked, but the combination of unittest and debugger did not work in that breackpoints were completely ignored.

0

I probably should say that the feature may exist but not obvious enough for an inpatient developer to discover :-)

0

Hello Sachko,

The feature is certainly present in PyCharm. Press the "Open Directory" button
in the welcome screen and point to your existing code.

The problem was not really about unittest.  It was rather the lack of
"import existing source code" feature.  Bang!  Right there, I stoped
doing anything futher.  As you can see, I've been already working on a
big code basis, and can't afford starting from scratch.  Netbeans's
unittest worked, but the combination of unittest and debugger did not
work in that breackpoints were completely ignored.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Thank you, Dmitry.  It's unfortunate that "Open Directory" sounds like a misdemeaner, to me at least who's English is not the first language :-)  I had seen that menu, yes, but ignored.  I also searched Help by "import" and, at first glance, none ringed bell.  The help search by "import" as the keyword yielded entries related to source code control systems (svn, cvs) and the Python import statement.  The choice of keyword "import" may not be the best but it's the word used by many other IDEs regardless of programming language.  Also, the import feature is usually given as a choice when we attempt to introduce a new project into an IDE, which was not the case with PyCharm.  Now, with your insight, I am now looking into PyCharm.  Thanks.

0

Dmitry, YES!, PyCharm does work like a charm!

0

Same issue w/ Python 2.6.1, IntelliJ Ultimate 9.0.3, Ubuntu 10.10. Stack is:


[1200226]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: ChooseRunConfiguration
[1206430]  ERROR - pplication.impl.LaterInvocator - com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner(Lcom/intellij/execution/process/ProcessHandler;Lcom/intellij/execution/configurations/CommandLineState;Lcom/intellij/execution/configurations/RuntimeConfiguration;Ljava/lang/String;)Lcom/intellij/execution/ui/ConsoleView;
java.lang.NoSuchMethodError: com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil.attachRunner(Lcom/intellij/execution/process/ProcessHandler;Lcom/intellij/execution/configurations/CommandLineState;Lcom/intellij/execution/configurations/RuntimeConfiguration;Ljava/lang/String;)Lcom/intellij/execution/ui/ConsoleView;
 at com.jetbrains.python.testing.PythonTestCommandLineStateBase.createAndAttachConsole(PythonTestCommandLineStateBase.java:45)
 at com.jetbrains.python.run.PythonCommandLineState.execute(PythonCommandLineState.java:47)
 at com.jetbrains.python.run.PythonCommandLineState.execute(PythonCommandLineState.java:42)
 at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:98)
 at com.intellij.execution.runners.GenericProgramRunner$1.run(GenericProgramRunner.java:95)
 at com.intellij.openapi.project.DumbServiceImpl.runWhenSmart(DumbServiceImpl.java:80)
 at com.intellij.openapi.project.DumbService$1.run(DumbService.java:71)
 at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:319)
 at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
 at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
 at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:610)
 at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:500)
 at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
 at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
 at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
 at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[1206430]  ERROR - pplication.impl.LaterInvocator - IntelliJ IDEA 9.0.3  Build #IU-95.429
[1206430]  ERROR - pplication.impl.LaterInvocator - JDK: 1.6.0_22
[1206430]  ERROR - pplication.impl.LaterInvocator - VM: Java HotSpot(TM) 64-Bit Server VM
[1206430]  ERROR - pplication.impl.LaterInvocator - Vendor: Sun Microsystems Inc.
[1206430]  ERROR - pplication.impl.LaterInvocator - OS: Linux
[1206431]  ERROR - pplication.impl.LaterInvocator - Last Action: ChooseRunConfiguration

0

Sure, PyCharm works but PyCharm does not solve my problem. My Python tests run against a Scala server and I cannot start it from PyCharm, so that's of little help to me.

Can someone port over the fix to the Python plugin in Intellij IDEA? Or explain how to run Scala code from PyCharm.

0

Please sign in to leave a comment.