unittest import error

  • Anonymous - 2006-11-29

    I have a package 'UnitTests', containing the following file TestWork.py:

    import unittest

    #import StartUp

    class TestWork(unittest.TestCase):

        def testOne(self):
            self.assertEqual(True, False)

    if __name__ == '__main__':

    The folder also contains __init__.py:
    __all__ = [TestWork]

    If I run it, the unit test works OK, but if I uncomment 'import StartUp' which is a module in the root folder (one down from UnitTests), there is an error when importing TestWork.

    How do I rectify this?  I would appreciate suggestions, I'm sure it's something simple that I'm missing.

    • Anonymous - 2006-11-30

      I managed to solve this by going to Project -> Properties, and adding all source folders to PYTHONPATH.

      • Fabio Zadrozny

        Fabio Zadrozny - 2006-11-30

        Yeap, that's the right way for doing it.

        You should take a look at the getting started manual: http://fabioz.com/pydev/manual_101_root.html it covers topics on how to configure your project (among others).




Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks