Import Runtime PycharmWarning after upgrading to 2016.2

After updating to the new version 2016.2, I get

RuntimeWarning: Parent module 'tests' not found while handling absolute import import unittest RuntimeWarning: Parent module 'tests' not found while handling absolute import import datetime as dt 

'tests' is a package inside my main application package, and I get these warnings when I try to run unit tests inside this folder. This issue only occurred after upgrading to 2016.2. In addition to warnings, the remaining code works fine.

Edit: this is a known issue - https://youtrack.jetbrains.com/issue/PY-20171 . They suggest replacing utrunner.py in the PyCharm installation folder.

+64
python import pycharm
Jul 25 '16 at 14:08
source share
5 answers

This is a known issue with the 2016.2 release. Progress can be made on the JetBrains website here . According to this page, it should be fixed in the 2017.1 release. You can follow the workaround utrunner.py that others mentioned at the same time - a copy of this file is attached to the associated ticket.

+65
Aug 02 '16 at 15:21
source share
β€” -

The final recommendation (December 19, 2016) is to put this line at the top of your unit test script:

 from __future__ import absolute_import 
+32
Dec 28 '16 at 2:37
source share

In OS X, I fixed this by replacing

 Applications/PyCharm.app/Contents/helpers/pycharm/utrunner.py 

with an older version that can be found at http://code.metager.de/source/xref/jetbrains/intellij/community/python/helpers/pycharm/utrunner.py

+14
Jul 30 '16 at 6:21
source share

On Ubuntu 16.04, Bobby also works:

Just replace the local utrunner.py file with

 /usr/local/pycharm-edu-3.0/helpers/pycharm/utrunner.py 

on the Jetbrains website: http://code.metager.de/source/xref/jetbrains/intellij/community/python/helpers/pycharm/utrunner.py

+2
Nov 08 '16 at 14:30
source share

Bobby also works on Windows 10:

Just replace the local utrunner.py file with

 C:\Program Files (x86)\JetBrains\PyCharm 2016.3\helpers\pycharm 

with a site from the Jetbrains website: http://code.metager.de/source/xref/jetbrains/intellij/community/python/helpers/pycharm/utrunner.py

0
Dec 04 '16 at 20:50
source share



All Articles