Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (45.3k points)

I have a problem with PYCharm 3.0.1 I can't run basic unittests.

Here is my code :

import unittest

class IntegerArithmenticTestCase(unittest.TestCase):

def testAdd(self):  ## test method names begin 'test*'

    self.assertEquals((1 + 2), 3)

    self.assertEquals(0 + 1, 1)

def testMultiply(self):

    self.assertEquals((0 * 10), 0)

    self.assertEquals((5 * 8), 40)

if __name__ == '__main__':

    unittest.main()

Here is All the stuff pycharm give me

Unable to attach test reporter to test framework or test framework quit unexpectedly

It also says

AttributeError: class TestLoader has no attribute '__init__'

And the event log :

2:14:28 PM Empty test suite

The problem is when I run manually the python file (with pycharm, as a script)

----------------------------------------------------------------------

Ran 1 tests in 0.019s

FAILED (failures=1)

Which is normal, I make the test fail on purpose. I am a bit clueless on what is going on here more information: Setting->Python INtegrated Tools->Package requirements file: /src/test Default test runner: Unittests pyunit 1.4.1 Is installed.

Thank you for any kind of help.

1 Answer

0 votes
by (16.8k points)

Although this wasn't the case with the original poster, I'd like to note that another thing that will cause this are test functions that don't begin with the word 'test.'

class TestSet(unittest.TestCase):

    def test_will_work(self):

        pass

    def will_not_work(self):

        pass

Related questions

0 votes
1 answer
0 votes
0 answers
asked Jan 5, 2021 in Python by spec300 (120 points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...