-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test not published to Report Portal when docstring or parameter contains \0 #382
Comments
@AlexLitvino \0 is not a text character, it is strictly binary one. So strictly, that many libraries use it to check if data is binary or text. And RP wasn't supposed to work with binary data. Also in general we do not modify data on client side, except some special cases, so it's your responsibility to sanitize it. |
@HardNorth , regarding \0 in docstrings I agree with you that it could be updated from our side.
I used such workaround for it, but it's not so obviously:
|
@AlexLitvino OK, I can add escaping of this symbol, but only this one. |
@AlexLitvino Done, use this release: https://github.com/reportportal/agent-python-pytest/releases/tag/5.4.7 |
@HardNorth , thank you. Checked, everything ok |
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: