I am trying to use pipeline to automate unit testing of my python code.
Here is the pipeline YML script
# Run unit tests for python libraries
image: python:3.7.3
pipelines:
default:
- step:
caches:
- pip
script: # Modify the commands below to build your repository.
- pip3 install numpy
- pip3 install opencv-python
- python -m unittest discover -s python/UnitTests/
The script runs and the test fails but the pipeline say success
here is the output in the pipeline window
+ python python/UnitTests/testAll.py
test_Overalp (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... FAIL
test_emptyList (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... ok
test_identicalBoxs1stScore (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... FAIL
test_identicalBoxs2ndScore (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... FAIL
test_identicalBoxsNoScore (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... FAIL
test_singleBox (DeepTrackingTests.testNonMaxima.TestNonMaxima) ... FAIL
======================================================================
FAIL: test_Overalp (DeepTrackingTests.testNonMaxima.TestNonMaxima)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/atlassian/pipelines/agent/build/python/UnitTests/DeepTrackingTests/testNonMaxima.py", line 53, in test_Overalp
self.assertEqual(1, len(shouldBe1))
AssertionError: 1 != 0
======================================================================
FAIL: test_identicalBoxs1stScore (DeepTrackingTests.testNonMaxima.TestNonMaxima)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/atlassian/pipelines/agent/build/python/UnitTests/DeepTrackingTests/testNonMaxima.py", line 29, in test_identicalBoxs1stScore
self.assertEqual(1, len(goodIndexes))
AssertionError: 1 != 0
======================================================================
FAIL: test_identicalBoxs2ndScore (DeepTrackingTests.testNonMaxima.TestNonMaxima)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/atlassian/pipelines/agent/build/python/UnitTests/DeepTrackingTests/testNonMaxima.py", line 37, in test_identicalBoxs2ndScore
self.assertEqual(1, len(goodIndexes))
AssertionError: 1 != 0
======================================================================
FAIL: test_identicalBoxsNoScore (DeepTrackingTests.testNonMaxima.TestNonMaxima)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/atlassian/pipelines/agent/build/python/UnitTests/DeepTrackingTests/testNonMaxima.py", line 44, in test_identicalBoxsNoScore
self.assertEqual(1, len(goodIndexes))
AssertionError: 1 != 0
======================================================================
FAIL: test_singleBox (DeepTrackingTests.testNonMaxima.TestNonMaxima)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/opt/atlassian/pipelines/agent/build/python/UnitTests/DeepTrackingTests/testNonMaxima.py", line 21, in test_singleBox
self.assertEqual(1, len(goodIndexes))
AssertionError: 1 != 0
----------------------------------------------------------------------
Ran 6 tests in 0.001s
FAILED (failures=5)
Hi Gadi,
Pipelines uses the exit code of the command to determine whether the step passed or failed. If your step is passing it probably means that the command ("python python/UnitTests/testAll.py") is returning a zero exit code.
Thanks,
I figured it out. I had a non test file being called as the last script and that returned 0. I removed it and it all works fine now.
Thanks for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.