PyCharm 1.5.3 Missing Mark Directory as Test Sources

I trialed PyCharm 1.1 a few months back and had a small project with unit tests.

Today, I purchased a key and downloaded 1.5.3. I went to create a new project and started getting my structure set up when I noticed that I could no longer mark directories for tests. I googled and came upon this link for PyCharm's guide.

It shows being able to mark directories as sources, tests, and for exclusion. However, I seem to be missing all options for test directories.

Did this feature get removed since 1.1?

It's not a huge deal. Just very curious and can't find a shred of information other than the guide saying I should be able to do it.

Thanks a lot and in advance for all replies. :-P

9 comments
Comment actions Permalink

If anyone is stumbling over this, there is a way to mark a directory green, even if it doesn't do anything functional:

  1. Mark the directory as "sources root"
  2. Open the <project root>/.idea/<projectname>.iml file in a text editor like sublime text or notepad++
  3. Search for "isTestSource=" and change it from "false" to "true"
  4. Ta-Daaaa! You're done.
3
Comment actions Permalink

Documentation for PyCharm is using a common screenshot from IDEA platform where such option is indeed available for Java. PyCharm doesn't have such an option, documentation should be updated in order not to confuse users.

0
Comment actions Permalink

So, then am I to assume that the feature has been removed from PyCharm since at one point it did exist?

I'll go ahead and mark the question as answered since it doesn't seem that I am missing a pre-requisite and it isn't a bug.

0
Comment actions Permalink

Hello Justin,

It was not really "a feature". There was a menu item to mark a directory

as test sources but the PyCharm code did not, and still does not, make any

use of such marking.

So, then am I to assume that the feature has been removed from PyCharm

since at one point it did exist?

I'll go ahead and mark the question as answered since it doesn't seem

that I am missing a pre-requisite and it isn't a bug.

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

I was seeing the same thing.  I appreciate your explaination.  One question. Would it be possible to allow the marking of the directory as "test" (green) anyway?  Even if it does nothing functional?  The reason is that is a very nice visual to help draw my eye to where test code is located.  I have been using it in the previous dot releases.

Please consider this for a future patch. 

0
Comment actions Permalink

Thank you Philip. As silly as it may be to change the color without any functional difference, I wanted it done and your trick worked like a charm.

Whether having an extra sources root impacts anything else is yet to be seen, but for now I'm content.

0
Comment actions Permalink

I agree it would be nice to be able to mark them as test source directories, even if just for the visual difference.

I had spotted the work around Phillip mentioned when committing the changes to git, but it's a faff to have to do this in the .iml file.

0
Comment actions Permalink

no guys, it's not just for visuals! it was possible to run test directly in pycharm!

although some types of tests (while mocking requests to API or accessing a file) did not work, basic unit tests were possible. now that is not possible anymore and you cannot write code in TDD easily, you have to have opened terminal and run `pytest -k test_funtion_name` every time.

I say booooo, simply because it was possible few weeks ago and it is possible to run test in phpstorm and idea for ages. why was this feature now removed?

also also, this trick does not work https://stackoverflow.com/questions/47871354/extract-street-address-without-numbered-street-names

please, fix what you broke

 

0
Comment actions Permalink

>no guys, it's not just for visuals! it was possible to run test directly in pycharm!

This should still be possible. Make sure the correct default test runner is set in the settings and you should be able to run the tests by right-clicking on them in the project view (or pressing green arrow in the editor).

If it's not working for you, please submit a ticket to https://youtrack.jetbrains.com or use support form at https://intellij-support.jetbrains.com/hc/en-us/?pycharm

0

Please sign in to leave a comment.