If you use the unittest module, I suggest you to use self.fail() instead: it is standard. Moreover, you can specify a message.
https://docs.python.org/dev/library/unittest.html#unittest.TestCase.fail

Victor

Le ven. 23 oct. 2020 à 21:36, Umair Ashraf <umr.ashrf@gmail.com> a écrit :
Hello

Can I suggest a feature to discuss and hopefully develop and send a PR. I think having a fail keyword for unit testing would be great. So we write a test as follows which will fail to begin with.

class MyTest(unittest.TestCase):
   def test_this_and_that(self):
      """
      Given inputs
      When action is done
      Then it should pass
      """
      fail

This keyword is to fill an empty function block like pass but this will make the function raise an exception that test is failing. I know there is raise but I feel this fail keyword is needed to write a test first which fails and then write code and then come back to the test and fill its body.

Umair 

--

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/QPOVO34K63CLEY66GSY5JOLWBRG5QRUM/
Code of Conduct: http://python.org/psf/codeofconduct/


--
Night gathers, and now my watch begins. It shall not end until my death.