views:

102

answers:

1

I've tried to run the following code on Komodo IDE (for python):

import unittest

class MathLibraryTests(unittest.TestCase):
    def test1Plus1Equals2(self):
        self.assertEqual(1+1, 2)

Then, I created a new test plan, pointing to this project(file) directory and tried to run it the test plan. It seems to run but it doesn't seem to find any tests.

If I try to run the following code with the "regular" run command (F7)

class MathLibraryTests(unittest.TestCase):
    def testPlus1Equals2(self):
        self.assertEqual(1+1, 2)

if __name__ == "__main__":
    unittest.main()

it works. I get the following output:

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK

What might I be doing wrong?

+2  A: 

For the test file to be picked up the filename must start with test_. I tried using just test.py which failed, however test_.py works like a dream.

All you need to do is rename your file. This is not made very clear in the documentation - I worked it out via a bug report on Komodo's web site.

It would be nice if Komodo gave at least a clue to the problem!

Scott Griffiths