Context menu issues when attempting to run Python tests

Answered

I currently have a variety of issues when attempting to executing Python py.text test cases. This began sometime this calendar year after upgrading the IDE. As a workaround I have simply been executing tests from the command line, and finally have some time to troubleshoot this.

  • Mac OSX Sierra 10.12.6
  • Python 2.7.13
  • Pytest 3.2.1 and 3.2.5

1. The right-click context menu no longer provides class and testcase execution options, only a general "Run" for the entire module. 

2. My existing test code won't invoke Pytest in the context menu at all. It appears it's trying to run Unittest instead. I haven't definitively narrowed down why my existing test modules won't show pytest at all, but it seems related to having setup_method() and teardown_method() in my test classes. If I comment those out then pytest appears as a runner. Though I've whipped up a very simple shell of a test module with setup_method() and teardown_method() and it currently shows pytest as a runner in the context menu.

I've cleared ALL of the run configurations, invalidate caches, have tried the following builds all of which exhibit this issue:

  • 2017.2.6
  • 2017.3 RC
  • Pycharm CE 2017.2   

However, if I go all the way back to Intellij 2016.3.7 everything works great and as expected. For what I'm doing this is probably acceptable.

 

0
5 comments
Official comment

Hello.

There were some bugs with ``setup_method`` and test detection, they are already fixed in 2017.3 PyCharm, but probably they are not available in Python plugin yet. To force PyTest instead of unittest you may set "Pytest" as default test runner in Python Integrated Tools.

 

I'd suggest to wait for next 2017.3 plugin and give it a try. If issue will still exist, please file us bug report: https://youtrack.jetbrains.com/

 

Avatar
Permanently deleted user

When does the fixed release ? I also encounter this issue now. Thanks

0

2018 versions should already contain all the fixes as long as 2017.3.5. Could you please file a ticket in our bug tracker and provide more details?

0
Avatar
Permanently deleted user

I update to latest version, it's already fixed. Thanks

0
Avatar
Permanently deleted user

Correct IntelliJ version 2017.3.4 does not have this issue.

0

Please sign in to leave a comment.