Skip to content
Advertisement

Unittest is throwing an error Empty suite

Python is throwing an error ‘Empty suite’ when I test my code. The strange thing is when I run

JavaScript

Then this will work, however when I run the actual test for my code

JavaScript

This will throw me like :

JavaScript

I guess it’s not an issue with unittest but only my code. Source code itself is working fine when I run it separately.. I don’t understand why it isn’t testing the actual code.. Any idea? please share..

Advertisement

Answer

Your method should start with ‘test’: https://docs.python.org/3/library/unittest.html#unittest-test-discovery

testMethodPrefix

String giving the prefix of method names which will be interpreted as test methods. The default value is ‘test’.

This affects getTestCaseNames() and all the loadTestsFrom*() methods.

User contributions licensed under: CC BY-SA
13 People found this is helpful
Advertisement