0

I know that I could add:

if __name__ == '__main__':
    unittest.main()

and run code via CMD like: python unit_test.py But I want add some arguments which will be pass to script and work with them:

python unit_test.py program_to_test.py input_or_output_data.txt

My second question is: is possible to import module from command line? basically I want to add module program_to_test.py from CMD and work with that?

I try add arguments with argparse but program always give me error:

ERROR: program_to_test (unittest.loader._FailedTest)
----------------------------------------------------------------------
AttributeError: module '__main__' has no attribute 'program_to_test'

======================================================================
ERROR: input_data (unittest.loader._FailedTest)
----------------------------------------------------------------------
AttributeError: module '__main__' has no attribute 'input_data'

----------------------------------------------------------------------
Ran 2 tests in 0.001s`
falkosa
  • 1
  • 1
  • Please edit your question to correct the formatting problems. There is help available within the editor. – larsks Dec 14 '22 at 13:05

0 Answers0