0

I am running a unittest using arguments from command line. Below is my test code.

import unittest
import sys
from toolbox.models import *
akit_id = sys.argv[1]

class TestQuizCase(unittest.TestCase):

    def testupdate_quiz(self):
        akit = AssignmentKit.objects.get(pk = akit_id)
        akit.update_score_grade()
        self.assertEqual(akit.marks, 50000)

if __name__ == "__main___":
    del sys.argv[1:]
    unittest.main()

Now from command line I'm doing:

>>> python test_quiz.py 2000

Nothing comes, thus no tests ran. I tried logging and found that the control is not even entering the test function. What am I missing is it sys.argv which is causing problem?

Coderaemon
  • 3,619
  • 6
  • 27
  • 50

1 Answers1

5

You have three undrescores in "__main___". So the code never enters unittest.main(). There should be only two.

Alex Shkop
  • 1,992
  • 12
  • 12