unable to attach test reporter to test framework

I am seeing this error (which means I cannot run tests) in the Python plugin in Intellij U - both the 10.5 release (107.105) and the latest EAP (107.148).

The test case that I am trying to run is http://code.google.com/p/lepl/source/browse/src/lepl/_example/expression.py - note that it is a subclass of a subclass of TestCase.

If I try a more normal situation (subclasses of TestCase) then I see "No tests were found" - http://code.google.com/p/lepl/source/browse/src/lepl/matchers/combine.py for example

In both cases the Python plugin is 2.7.0 and I am using Python 3.2 in a virtualenv (but I see the same if I use /usr/local/bin/python3.2).

Andrew

Previously reported at http://devnet.jetbrains.net/thread/304707?tstart=0

11 comments
Comment actions Permalink

More info: I think the two errors above (attach v not found) depend on whether I am running a test for a whole file or just one method (I am new to IntelliJ and didn't notice the difference at first).

Working with http://code.google.com/p/lepl/source/browse/src/lepl/_test/magus.py I see the following message when I try to run a method:

/usr/local/bin/python3.2 /home/andrew/.IntelliJIdea10/config/plugins/python/helpers/pycharm/utrunner.py magus.py::MagusTest::test_magus true

Testing started at 7:19 PM ...

Traceback (most recent call last):

  File "/home/andrew/.IntelliJIdea10/config/plugins/python/helpers/pycharm/utrunner.py", line 147, in <module>

    testCaseClass = getattr(module, a[1])

AttributeError: 'NoneType' object has no attribute 'MagusTest'

Process finished with exit code 1

If I delete the contents of that file and replace them with a minimal test, it still fails.  BUT if I place that minimal test in new file in the same directory, it works.
Ahhhh.  It depends on the name of the file?  You expect me to put every f***ing test in a file called "test"?!
I will try and find the config.
Andrew
0
Comment actions Permalink

Please, how do I configure what file names to accept for tests?  Or am I still not understanding why this fails?

Andrew

0
Comment actions Permalink

Hi, Andrew.

Yes, now for unittest configuration test files should start with "test" prefix. It'll be fixed in the new version of plugin.

Also, you can file an issue here: http://youtrack.jetbrains.net/issues/PY

If you use "all tests in folder" configuration you can specify pattern for test file names.

0
Comment actions Permalink

Thanks for the reply.  I just tried PyCharm 1.5RC and that does have a warning (which I think is new?) about the file name.

I am trying the "all tests in folder" (whch would be fine) but when I put ".*" or "*" in the "Pattern" box, it says that there is an error in the configuration (again, this is with PyCharm standalone - I will switch back to InteiilJ Idea U now and see if I can get that to work).

[later] NOPE - http://youtrack.jetbrains.net/issue/PY-3786?query=test

Cheers,

Andrew

0
Comment actions Permalink

I'm having this same problem on pycharm 1.5 with python 2.6.1 and django 1.2.5.

Any followups or ideas?

0
Comment actions Permalink

not sure if it's clear from the above and related, but if the module (filename) starts with "test" then i think it does work.  also, you can run the tests outside the IDE - for example, by using nose (that also expects tests to be named ina certain way, but you can configure it with your own regexp).

hopefully there will be a new release soon...

andrew

0
Comment actions Permalink

In my case I have multiple apps in the project. I'm trying to run one set of tests (in file tests.py) in an app (api) when I see the problem.

0
Comment actions Permalink

the best workaround i've found for this is to use pytest from the command line.  http://doc.pytest.org/en/latest/

i also looked at nose, which is another test runner (more popular than pytest i think), but pytest was better documented and easier to use.  nose had a hardcoded filter that refused to run tests in my _test directories because they began with an underscore - it's not documented and i ended up reading their source to find the cause.  in contrast, pytest has no problems and it's config-file based setup is easier than anything i could find for nose.

andrew

ps it can also run tests in just one directory, etc etc.

0
Comment actions Permalink

Hi Andrew,

have you tried PyCharm's update 1.5.2? The issue seems to be fixed.

By the way, you can run nosetests and py.test from PyCharm.

Just create new run configuration manually (python's nosetests or py.test) or

specify test runner you wish to use in Settings->Python Integrated Tools so

pycharm can provide you run configuration from the context menu (right click mose, or Ctrl+Shift+F10)

0
Comment actions Permalink

is there a way to use that from intellij idea?  i keep looking for an update to the plugin, but it stays the same.  andrew

0
Comment actions Permalink

Unfortunately, there is no way. We're going to release plugin as soon as possible.

Keep in touch.

0

Please sign in to leave a comment.