Title: Python Unittest does not return results object when the test is skipped
Type: Stage:
Components: Versions: Python 3.9
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Tabrizian, ezio.melotti, iritkatriel, michael.foord, rbcollins, terry.reedy
Priority: normal Keywords:

Created on 2020-08-23 17:50 by Tabrizian, last changed 2021-01-12 18:10 by iritkatriel.

Pull Requests
URL Status Linked Edit
PR 21944 open Tabrizian, 2020-08-23 17:50
Messages (3)
msg375820 - (view) Author: Iman Tabrizian (Tabrizian) * Date: 2020-08-23 17:50
Result object is null when a test case is skipeed.
msg376074 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-08-29 20:02
You should justify the proposed change here on the issue, and see if the doc says anything about the issue either way.
msg384971 - (view) Author: Irit Katriel (iritkatriel) * (Python triager) Date: 2021-01-12 18:10
The justification on the PR is: 

"The problem is that when I'm trying to collect test results if one of the tests is being skipped the error below pops up because test_result object is None.
AttributeError: 'NoneType' object has no attribute 'testsRun'"

which can be worked around with a simple "is not None" check. 

There will be cases where someone wants to know that a test was not executed, and inspecting a TestResult object to see that it actually represents Nothing is not as natural.

I'm -1 on this change.
Date User Action Args
2021-01-12 18:10:46iritkatrielsetnosy: + iritkatriel
messages: + msg384971
2020-08-29 20:02:16terry.reedysetnosy: + ezio.melotti, terry.reedy, michael.foord, rbcollins
messages: + msg376074
2020-08-23 17:50:44Tabriziancreate