1

I am trying to base my project structure on this answer. According to the answerer, all I need to do is structure my application like this:

project-name
    project_name
        __init__.py
        some_module.py
        some_other_module.py
    tests
        __init__.py
        test_some_module.py
        test_some_other_module.py

However, running python3.5 -m unittest discover results in this error: ImportError: No module named project_name.

My __init__.py files are empty as I understood that would make python think everything was a package. I understand there is a way to do it using PYTHONPATH but I had also understood that there was no need to use PYTHONPATH if you followed this package system.

What am I doing wrong? Is there an easy fix, or do I need to use a different structure or system to run tests?

Community
  • 1
  • 1
user1
  • 770
  • 1
  • 11
  • 25

1 Answers1

1

According this link from python Doc: Python Module

I believe do you need create a __init__.py file in the first project-name root dir.

project-name
__init__.py
project_name
    __init__.py
    some_module.py
    some_other_module.py
tests
    __init__.py
    test_some_module.py
    test_some_other_module.py
Stortz
  • 11
  • 1
  • 2