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

Comments

Projects
None yet
3 participants
@philpep

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 to version 3.0.1
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 added a commit to hypothesis/h that referenced this issue Sep 2, 2016

Pin pytest to version 3.0.1 (#3818)
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

This comment has been minimized.

Member

nicoddemus commented Sep 2, 2016

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

tox: Don't use pytest 3.0.2
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 added a commit to Flexget/Flexget that referenced this issue Sep 4, 2016

@nickstenning

This comment has been minimized.

nickstenning commented Sep 28, 2016

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

@nicoddemus

This comment has been minimized.

Member

nicoddemus commented Sep 28, 2016

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

@nickstenning

This comment has been minimized.

nickstenning commented Sep 28, 2016

Woop! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment