I am using windows with python2.7. My program is quite simple. Taking an input via command line and checking if it is '5'.
Code:
import unittest
import sys
a=sys.argv[1]
print a
class TestCase(unittest.TestCase):
"""My tests"""
def test_is_number_is_five(self):
self.assertEqual('5',a)
if __name__ == '__main__':
unittest.main()
And running it using:
>>python test.py 5
I am getting this error:
Traceback (most recent call last):
File "C:\Python27\lib\unittest\main.py", line 94, in __init__
self.parseArgs(argv)
File "C:\Python27\lib\unittest\main.py", line 149, in parseArgs
self.createTests()
File "C:\Python27\lib\unittest\main.py", line 158, in createTests
self.module)
File "C:\Python27\lib\unittest\loader.py", line 130, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "C:\Python27\lib\unittest\loader.py", line 100, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute '5'