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

Cannot pass unicode string in parameterized ids with pytest 3.0.2 and python 2 #1905

Closed
philpep opened this issue Sep 2, 2016 · 4 comments
Closed
Labels
type: regression indicates a problem that was introduced in a release which was working previously

Comments

@philpep
Copy link

philpep commented Sep 2, 2016

Hi, since #1861 we cannot pass python 2 unicode object to parametrize():

sample code:

import pytest

@pytest.mark.parametrize('p', ['v'], ids=[u'v'])
def test_foo(p):
    pass

Error is:

v/local/lib/python2.7/site-packages/_pytest/python.py:105: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs)
v/local/lib/python2.7/site-packages/_pytest/python.py:837: in parametrize
    raise ValueError(msg % (saferepr(id_value), type(id_value).__name__))
E   ValueError: ids must be list of strings, found: 'v' (type: unicode)

Will this be fixed or should I encode my string only with python 2 (or both) ?

Thanks !

robertknight added a commit to hypothesis/h that referenced this issue Sep 2, 2016
Pin pytest version until
pytest-dev/pytest#1905 is resolved as it
caused memex tests to fail (eg.
https://travis-ci.org/hypothesis/h/jobs/157031235)
nickstenning pushed a commit to hypothesis/h that referenced this issue Sep 2, 2016
Pin pytest version until
pytest-dev/pytest#1905 is resolved as it
caused memex tests to fail (eg.
https://travis-ci.org/hypothesis/h/jobs/157031235)
@nicoddemus nicoddemus added the type: regression indicates a problem that was introduced in a release which was working previously label Sep 2, 2016
@nicoddemus
Copy link
Member

Thanks! Unfortunately I failed to take in account unicode strings on that check, my bad.

I will try to get to this ASAP and it will be fixed in 3.0.3.

nicoddemus added a commit to nicoddemus/pytest that referenced this issue Sep 2, 2016
nicoddemus added a commit to nicoddemus/pytest that referenced this issue Sep 2, 2016
dcbaker added a commit to dcbaker/piglit that referenced this issue Sep 2, 2016
There is a known issue[1], that causes this version to break piglit's
unitests. There is a fix queued for 3.0.3, and when that's released this
can be changed to '>=3.0.3'. In the meantime this patch fixes it by not
letting tox install the bad version.

[1] pytest-dev/pytest#1905

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
cvium added a commit to Flexget/Flexget that referenced this issue Sep 4, 2016
liiight pushed a commit to Flexget/Flexget that referenced this issue Sep 4, 2016
@nickstenning
Copy link

Hi folks. Would it be possible to release 3.0.3 with the fix for this issue?

@nicoddemus
Copy link
Member

Sure! In fact I'm planning on starting the release process today. 😄

@nickstenning
Copy link

Woop! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression indicates a problem that was introduced in a release which was working previously
Projects
None yet
Development

No branches or pull requests

3 participants