Skip to content
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

Escape test ID`s in Testing API #17810

Closed
rndev-io opened this issue Oct 20, 2021 · 5 comments
Closed

Escape test ID`s in Testing API #17810

rndev-io opened this issue Oct 20, 2021 · 5 comments
Labels
area-testing bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on

Comments

@rndev-io
Copy link

I have Python project with pytest's tests and I catch this error

Error: Test IDs may not include the "<path-to-test>/tests/unit/interactions/mastercard/test_mastercard.py::TestMasterCardDeleteCard::test_generic_404_exception_is_not_affected[\u0000]" symbol
	at new D (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at Object.createTestItem (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:95)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Array.forEach (<anonymous>)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at m (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Object.forEach (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at m (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Object.forEach (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at m (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Object.forEach (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at m (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Object.forEach (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at m (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9
	at Object.forEach (vscode-file://vscode-app/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:87)
	at g (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at Object.m [as updateTestItemFromRawData] (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:9)
	at _.resolveChildren (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:59)
	at _.refreshTestData (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:59)
	at processTicksAndRejections (internal/process/task_queues.js:93)
	at async v.refreshTestDataInternal (vscode-file://vscode-app/Users/perseus/.vscode/extensions/ms-python.python-2021.10.1336267007/out/client/extension.js:59)

Pytest allow to parametrize and test looks like this

    @pytest.mark.asyncio
    @pytest.mark.parametrize('body', ['', 'test', '{}', '{"test": true}', b'', b'\x00'])
    async def test_generic_404_exception_is_not_affected(

-> test_generic_404_exception_is_not_affected[\u0000] is valid test name

Screenshot 2021-10-20 at 11 48 18

Version: 1.61.2

@connor4312
Copy link
Member

connor4312 commented Oct 20, 2021

NUL bytes are not allowed in test IDs, since we use it for delimiters internally

@rndev-io
Copy link
Author

I found workaround using ids parameter

@pytest.mark.parametrize('body', ['', 'test', '{}', '{"test": true}', b'', b'\x00'], ids=str)

But this restrictions looks strange ...

@karthiknadig karthiknadig transferred this issue from microsoft/vscode Oct 20, 2021
@karthiknadig karthiknadig removed their assignment Oct 20, 2021
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 20, 2021
@karthiknadig karthiknadig self-assigned this Oct 20, 2021
@karthiknadig karthiknadig added area-testing triage bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels Oct 20, 2021
@karthiknadig
Copy link
Member

We have plans on rewriting the test adapter. We should handle this case there.

/cc @kimadeline

@kimadeline
Copy link

#17242

@karthiknadig karthiknadig removed their assignment Oct 25, 2021
@github-actions github-actions bot removed the needs PR label Aug 9, 2022
@karrtikr karrtikr added the needs PR Ready to be worked on label Aug 9, 2022
@karrtikr
Copy link

Closing in favor of #17242.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

5 participants