Relative imports with unittest in Python
问题 I am trying to use Python unittest and relative imports, and I can't seem to figure it out. I know there are a lot of related questions, but none of them have helped so far. Sorry if this is repetitive, but I would really appreciate any help. I was trying to use the syntax from PEP 328 http://www.python.org/dev/peps/pep-0328/ but I must have something wrong. My directory structure is: project/ __init__.py main_program.py lib/ __init__.py lib_a lib_b tests/ __init__.py test_a test_b I run my