0

I am following a tutorial for unittest in Python (https://docs.python.org/3/library/unittest.html).

I have a class with functions in it, Is there anyway if I want to run single function test from the class ?

Documentation says we can access individual test methods as below

python -m unittest test_module1 test_module2

Please refer attached image.

enter image description here

  • 1
    Please include the relevant code _as text_ in your question. Images are hard to read, aren't accessible to those that have trouble seeing and aren't searchable. How have you tried running the single test? From the linked documentation: `python -m unittest test_module.TestClass.test_method` - `calc.TestStringMethods.test_split` should map to that for your example? – MatsLindh Oct 19 '21 at 13:31
  • have you seen this: https://stackoverflow.com/questions/15971735/running-a-single-test-from-unittest-testcase-via-the-command-line – equatorial_daydreamer Oct 19 '21 at 13:32

1 Answers1

-1

Got the answer, the format as below,

python filename.py classname.function

calc.py TestStringMethods.test_upper