Runnings tests result in "Unable to attach test reporter (...)"

I have just installed the Python plugin in IntelliJ and was thinking I should check out how to run tests from within IntelliJ. After creating a testclass and right-clicking on the class, I chose "Run unittests in Utility...". I was then given the following message in the testrunner window and a stack dump
"Unable to attach test reporter to test framework or test framework quit unexpectedly"

Testing started at 4:19 PM ...
Traceback (most recent call last):
  File "/Users/carl-erik/Library/Application Support/IntelliJIdea11/python/helpers/pycharm/utrunner.py", line 9, in <module>
    from nose_helper import TestLoader, ContextSuite
  File "/Users/myUser/Library/Application Support/IntelliJIdea11/python/helpers/pycharm/nose_helper/__init__.py", line 2, in <module>
    from nose_helper.loader import TestLoader
  File "/Users/myUser/Library/Application Support/IntelliJIdea11/python/helpers/pycharm/nose_helper/loader.py", line 201, in <module>
    defaultLoader = TestLoader()
  File "/Users/myUser/Library/Application Support/IntelliJIdea11/python/helpers/pycharm/nose_helper/loader.py", line 43, in __init__
    unittest.TestLoader.__init__(self)     
AttributeError: class TestLoader has no attribute '__init__'

The tests run fine if run from a terminal: "python UtilityTest.py"
0
6 comments
Hi Carl-Erik,

please, go to Run->Run/Debug Configurations->Python's test->Unittests and check "Inspect only subclasses of ..." checkbox.
0
That was already checked. Still get the same error. I use the standard python shipped with OS X: version 2.6.8

/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6 "/Users/carl-erik/Library/Application Support/IntelliJIdea11/python/helpers/pycharm/utrunner.py" /Users/carl-erik/Utvikling/var/server_configurations/nw-ws-037.asplogon.com/currency/converter_test.py::UtilityFunctionsTest false
Testing started at 1:53 PM ...
...(more)
0
I am starting to suspect this has something to do with the Python that is shipped with OS X. I just installed Python 3 through Homebrew, added the SDK, and ran the tests by use of it in IntelliJ. Flawless execution (except for a couple of failing tests due to differences between version 2 and 3, of course).
0
It was indeed the case. I installed Python 2.7.3 through Homebrew, and used that as the SDK. All tests passed and no errors showed. Seems the default Python in OS X 10.6.8 is not ok to use with IntelliJ.
0
Avatar
Permanently deleted user
I am having the exact same problem.  I am on Ubuntu with Python 2.7.3 and Pycharm 2.6.2.  This is my console output when I try to run a test:


/usr/bin/python ~/Downloads/pycharm-2.6.2/helpers/pydev/pydevd.py –multiproc –client 127.0.0.1 –port 50363 –file ~/Downloads/pycharm-2.6.2/helpers/pycharm/utrunner.py ~/myProject/test/Test.py::Test true
Testing started at 5:31 PM ...
pydev debugger: process 7076 is connecting
Traceback (most recent call last):
  File "~/Downloads/pycharm-2.6.2/helpers/pydev/pydevd.py", line 1457, in <module>
    debugger.run(setup['file'], None, None)
  File "~/Downloads/pycharm-2.6.2/helpers/pydev/pydevd.py", line 1103, in run
    pydev_imports.execfile(file, globals, locals) #execute the script
  File "~/Downloads/pycharm-2.6.2/helpers/pycharm/utrunner.py", line 9, in <module>
    from nose_helper import TestLoader, ContextSuite
  File "~/Downloads/pycharm-2.6.2/helpers/pycharm/nose_helper/__init__.py", line 2, in <module>
    from nose_helper.loader import TestLoader
  File "~/Downloads/pycharm-2.6.2/helpers/pycharm/nose_helper/loader.py", line 201, in <module>
    defaultLoader = TestLoader()
  File "~/Downloads/pycharm-2.6.2/helpers/pycharm/nose_helper/loader.py", line 43, in __init__
    unittest.TestLoader.__init__(self)     
AttributeError: class TestLoader has no attribute '__init__'

Process finished with exit code 1



Do I need to install something additional?
0
You need to add that Python SDK to your available SDKs and set that as your modules preferred SDK in the Module Preferences (highlight the module and press F4). If you don't, you will not run using Python 2.7.3, but the default python install that comes with your OS.
0

Please sign in to leave a comment.