Running testr with --subunit option always returns 0

Bug #1203722 reported by Roman Podoliaka
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Testrepository
Invalid
Undecided
Unassigned

Bug Description

Consider the following test suite:

import unittest

class Test(unittest.TestCase):
    def test_case1(self):
        self.assertTrue(3 > 1) # success

    def test_case2(self):
        self.assertTrue(5 > 1) # success

    def test_case3(self):
        self.assertTrue(2 < 1) # fail

    def test_case4(self):
        self.assertTrue(1 > 2) # fail

    def test_case5(self):
        self.assertTrue(0 > 2) # fail

.testr.conf:

[DEFAULT]
test_command=python -m subunit.run discover . $LISTOPT $IDOPTION
test_id_option=--load-list $IDFILE
test_list_option=--list

Running tests with "testr run" works great:
rpodolyaka@rpodolyaka-pc:~/sandbox/tesrt$ testr run > /dev/null
(venv)rpodolyaka@rpodolyaka-pc:~/sandbox/tesrt$ echo $?
1

The process exit code is 1, because the test suite failed, and this was expected.

However, when --subunit option is used, the exit code is always 0, even if some tests fail:
(venv)rpodolyaka@rpodolyaka-pc:~/sandbox/tesrt$ testr run --subunit > /dev/null
(venv)rpodolyaka@rpodolyaka-pc:~/sandbox/tesrt$ echo $?
0

Revision history for this message
Robert Collins (lifeless) wrote :

This is deliberate, because it's up to the subunit consumer to decide success/fail, as long as the stream was successfully generated.

Changed in testrepository:
status: New → Incomplete
Revision history for this message
Robert Collins (lifeless) wrote :

Can you describe what problem this causes for you?

Changed in testrepository:
status: Incomplete → New
status: New → Incomplete
Revision history for this message
Robert Collins (lifeless) wrote :

Timing the bug out after nearly a year with no reply.

Changed in testrepository:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.