help running unittests. Cannot load the module inside the test

Hi, lets say I have the following directory format:

project1/
     src/
         unit/
             mdtest/
  __init__.py
  mytest.py
          __init.py

     test/
         unit/
             mdtest/
  __init__.py
  test_mytest.py
          __init.py
  

and mytest.py is:
<code>
class MyTest(object):
    def __init__(self, vara):
        self.v = vara
    def printr(self):
        print self.v

def my_delf(a, o):
    return a + o


if __name__ == "__main__":
    a = MyTest('trrr')
    a.printr()
    my_delf(5,7)

</code>

and test_mytest.py is:
<code>
import unittest
from unit.mdtest.mytest import MyTest, my_delf

if __name__ == "__main__":
    a = MyTest('trrr')
    a.printr()
    my_delf(5,7)

</code>


This test script fails to import the mytest.py module. It only works if I rename the test package to something different than mdtest. Am I missing something here?

Please sign in to leave a comment.