4

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?

devoured elysium
  • 101,373
  • 131
  • 340
  • 557

1 Answers1

6

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
  • 21,438
  • 8
  • 55
  • 85
  • This filename pattern is also a requirement in PyCharm, should you want the unit test to run. Anywa, somehow we just want our IDE to decide which unittest that he needed to run, but.. well, we're out of luck. :) – swdev Feb 11 '14 at 00:04