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
@pytest.mark.parametrize handles escape characters differently for Python2 and Python 3 #24888
Comments
cc @jgraham could you take a look? I think these test names are generated by pytest, so whatever escaping happens there. Is there anything we can do? Or would you (and other folks working on WebDriver) be fine with the change of test names? (To me, the PY3 representation seems more user-friendly.) |
I think this was a change in pytest after it went Python 3 only? |
I'm not very worried by a small number of changes here. |
Given that this is just a few (~10?) tests in |
It sounds like nobody is worried by this? |
Yep; closing working as intended. @ziransun - please note but ignore any diffs caused by this problem in your Py2/Py3 analysis work. |
Updated the analysis worksheets. |
When calling
@pytest.mark.parametrize
in tests, if argument contains escape characters (e.g.\n
,\t
etc.), it produces different test names in PY2 and PY3.Examples:
https://wpt.fyi/results/webdriver/tests/send_alert_text/send.py?diff&filter=ADC&run_id=632440001&run_id=619000003
https://wpt.fyi/results/webdriver/tests/find_element/find.py?diff&filter=ADC&run_id=632440001&run_id=619000003
This is very likely due to that in PY2 the default type for strings was str, but it was stored as byte while in PY3 str corresponds to unicode type. Python string literals treat backslashes as initiating escape sequences (e.g.
\n
is LF). For unicode, it retains characters as it is (e.g.'\n'
is'\n
').It is also noted that @pytest.mark.parametrize expects
str
type arguments.The text was updated successfully, but these errors were encountered: