0

I am using PyCharm (Build #PC-201.6668.115 built on April 7, 2020) on Mac OS Catalina version 10.15.3. I'm getting "Unresolved reference 'activities'" when I try to import activities.py for unittest. I read the thread on StackOverflow and set the folder Python3Bootcamp to "mark as Sources Root" and Preferences > Build, Execution, Deployment > Console > Python Console to check "Add source roots to PYTHONPATH".

What can I do to properly import the Python file for UnitTest?

This seemed to satisfy PyCharm's error messages:

from testing.unittest.activities import eat, nap

but when I ran "python3 tests.py" I got "ModuleNotFoundError: No module named 'testing'"

trouble importing file in PyCharm

Tachyon80
  • 147
  • 10
  • Why do you use `/` instead of dots in the import in the screenshot? – Pavel Karateev Apr 24 '20 at 13:10
  • PyCharm, although updated to latest, isn't perfect. Just "from activities" is enough to work even though the message in the IDE says it won't work. – Tachyon80 Apr 25 '20 at 16:16
  • Do you mean `from activities import ...` in `tests.py`? It will work in some cases but not always see https://stackoverflow.com/a/51820200/2787185 – Pavel Karateev Apr 25 '20 at 19:21

0 Answers0