0

Code in azure python script task:

import unittest


class MySampleTests(unittest.TestCase):

    def test_for_200_code(self):
        self.assertEqual(200, 200)


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

If I enable 'Fail on standard error', then, the output of azure task has got the foll.:

##[error]C:\ProgramData\Anaconda3\python.exe failed with return code: 0

Irrespective of whether the assert fails or passes, I am getting the above error when 'Fail on standard error' is checked. I know that 'Fail on standard error' causes the task to fail if something is written to the stderr.

But in the above simple example, what is the reason for this error? And how to correct this?

variable
  • 8,262
  • 9
  • 95
  • 215
  • Can it run successfully? If 'Fail on standard error' is not checked. – Hugh Lin Nov 01 '19 at 11:17
  • When 'Fail on standard error' is not checked, then it works correctly. That is - the task succeeds if I use the same code (assertion) as above. And if I change the code such that the assertion fails [ For example: self.assertEqual(200, 201) ], then the task fails. This is as expected. However, if I check-mark the 'Fail on standard error', then, the task fails irrespective of whether the assertion passes or fails. – variable Nov 01 '19 at 11:21
  • You can try using private agent to run to see if the problem still exists.In addition,you can also place a ticket on our [Developer Community](https://developercommunity.visualstudio.com/spaces/21/index.html) form for more help. – Hugh Lin Nov 06 '19 at 11:59

0 Answers0