tox support quirks

Answered

Hi folks, I've used PyCharm for ages and it's awesome! I've started a new job and they use tox a bunch, and I'm finding some quirks with the tox support in PyCharm that I'm wondering whether they're me, or PyCharm, and what I need to do to address them:

  1. PyCharm inspection marks most of the code invalid because it can't find modules ("no module named requests", for example). I have configured the Project Interpreter to be the python inside the .tox venv (it detects that as a virtualenv) and restarted PyCharm, but it still doesn't recognise the "requests" module (or many others) installed in that venv.
  2. PyCharm seems to think my tox test suite doesn't have any tests. At the end of a test run (using the built-in Tox configuration) it says "Empty test suite." And unlike tests run in other ways, the list of tests in the Test Results display is empty.

Additionally, it would be super cool if PyCharm could work with pytest-cov coverage runs in some way.

3 comments

Hello! Could you please send us your project to pycharm-support@jetbrains.com to let us reproduce the issues? Thank you.

0

I have discovered how to make the first quirk go away: I'm on a Mac, and the PyCharm menus have two places to set Project Interpreter. The one in the File menu "Default Settings" seems to have no effect, but if I change the one in Preferences to point at the tox virtualenv the code inspection all works!

This is very confusing as to why the setting appears in two places and appears to have a very different impact on configuration in each case. One says "for default project" and the other says "for current project" but I honestly don't know what "default project" is, or how it relates to the current project. Additionally, I can't find the "for default project" in the Linux PyCharm interface...

Having addressed that I still get "Empty test suite." when I run the tox tests. I will email the project to your support address once I've gotten approval from my management.

0

Default Settings are used as defaults every time you create a new project - it is a kind of settings template for newly created projects (https://www.jetbrains.com/help/pycharm/accessing-default-settings.html). File| Settings are applied for current project/projects.

0

Please sign in to leave a comment.