Parent module 'not found while handling absolute import

Completed

I just upgraded my PyCharm from Version 2016.2 to 2016.2.3, and then re-ran a unit test that just succeeded before the upgrade.  It succeeded, but a bunch of warnings come up in the form:

/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:1: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
import unittest
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:2: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
import os
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:3: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
import json
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:4: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
from collections import Counter
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:6: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
from mine import idf
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:7: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
from util import dict_file_util
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:8: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
from txt_proc.feature_extractor import DocDictFeatureExtractor
/Users/eb/Work/SemanticClassifier/src/mine/tests/test_idf_calc.py:9: RuntimeWarning: Parent module 'mine.tests' not found while handling absolute import
from txt_proc.tkn_transform_pipeline import TokenTransformPipeline

The unit test is sitting in a file inside the 'mine.tests' package.  The warnings appear to show up for each and every import.

Both the 'mine' directory and the 'tests' directory have __init__.py files in them to make them into packages.

The run configuration has "Add source roots to PYTHONPATH" selected.  The 'src' directory, which is the parent of the 'mine' package directory is configured as a source root.

Anyone have any idea why this warning is popping up, when they were not coming up just before the upgrade?  Maybe they were always occurring but the upgrade reset some option I had selected before?  I have re-run all my unit tests in the repository and they are all throwing these warnings.

Thanks.

Here are the imports:

# Python Libs
import os
import sys
import shutil
# Internal Libs
from util.test_util.data import time_sep_src
from mine import idf_s3
from mine.idf import IdfCalculator
from txt_proc.feature_extractor import DocDictFeatureExtractor
from cfg.time_idf.time_idf_cfg import TimeIdfCfg
from util.fake_s3_test_base import FakeS3TestSuite
2 comments
Comment actions Permalink

New Information:  This problem only exists when running unit tests, not when running other scripts.  However, it occurs for all unit tests.

0
Comment actions Permalink

RESOLVED: Ok, found the fix.  I had forgotten that there is a known issue documented here, where they provide a temporary fix and indicate it is scheduled to be fixed in 2016.3.

1

Please sign in to leave a comment.