You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Result for test is not published to Report Portal when \0 is contained in:
docstring
value for parameterization
Steps to Reproduce
Run the following tests with publishing result to Report Portal:
def test_with_slash_zero_in_docstring():
"""This test verifies publishing \0 to Report Portal"""
pass
import pytest
@pytest.mark.parametrize('param', ['1\0',])
def test_with_param_with_slash_zero(param):
pass
Expected behavior
Test result is published to Report Portal (test launch is created with test items inside).
Actual behavior
Test launch is created but they are empty, doesn't contain any tests.
Sniffing packets with WireShark, the following Start root(suite) item requests were sent for the 1st and the 2nd tests: POST /api/v2/my_project/item
{"codeRef": "tests/test_example.py:test_with_slash_zero_in_docstring", "description": "This test verifies publishing \u0000 to Report Portal", "hasStats": true, "name": "tests/test_example.py::test_with_slash_zero_in_docstring", "retry": false, "retryOf": null, "startTime": "1732110741030", "testCaseId": "tests/test_example.py:test_with_slash_zero_in_docstring", "type": "STEP", "launchUuid": "b354fc52-5f18-4120-a864-3d531bab7077", "attributes": [], "parameters": null}
Note that if \0 is placed at the end of docstring line, result is published to Report Portal, though request contains \u000:
"description": "This test verifies publishing \u0000"
Also general issue here might be not escaping back slash. For example for test
def test_with_docstring_with_slash_n():
"""Test to verify publishing with new line
Precondition
- Create file
Action
- Write string 'A\nB' to the file
Result
- File contains string 'A\nB'
"""
pass
We get results as on image below. Not sure if it is should be separate issue.
And because of usage expandtabs in trim_docstring function of pytest_reportportal we got 8 whitespaces instead of \t.
The text was updated successfully, but these errors were encountered:
Result for test is not published to Report Portal when \0 is contained in:
Steps to Reproduce
Run the following tests with publishing result to Report Portal:
Expected behavior
Test result is published to Report Portal (test launch is created with test items inside).
Actual behavior
Test launch is created but they are empty, doesn't contain any tests.
Sniffing packets with WireShark, the following Start root(suite) item requests were sent for the 1st and the 2nd tests:
POST /api/v2/my_project/item
{"codeRef": "tests/test_example.py:test_with_slash_zero_in_docstring", "description": "This test verifies publishing \u0000 to Report Portal", "hasStats": true, "name": "tests/test_example.py::test_with_slash_zero_in_docstring", "retry": false, "retryOf": null, "startTime": "1732110741030", "testCaseId": "tests/test_example.py:test_with_slash_zero_in_docstring", "type": "STEP", "launchUuid": "b354fc52-5f18-4120-a864-3d531bab7077", "attributes": [], "parameters": null}
POST /api/v2/my_project/item
{"codeRef": "tests/test_example.py:test_with_param_with_slash_zero", "description": null, "hasStats": true, "name": "tests/test_example.py::test_with_param_with_slash_zero[1\x00]", "retry": false, "retryOf": null, "startTime": "1732111412360", "testCaseId": "tests/test_example.py:test_with_param_with_slash_zero[1\u0000]", "type": "STEP", "launchUuid": "4fd5a4cd-522e-495b-b356-1b6b00f35d36", "attributes": [], "parameters": [{"key": "param", "value": "1\u0000"}]}:
Package versions
pytest 8.3.2
pytest-reportportal 5.4.5
reportportal-client 5.5.9
Note that if \0 is placed at the end of docstring line, result is published to Report Portal, though request contains \u000:
"description": "This test verifies publishing \u0000"
Also general issue here might be not escaping back slash. For example for test
We get results as on image below. Not sure if it is should be separate issue.
And because of usage expandtabs in trim_docstring function of pytest_reportportal we got 8 whitespaces instead of \t.
The text was updated successfully, but these errors were encountered: