diff --git a/CHANGELOG b/CHANGELOG index 449724af7..e5c24d0e1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Changes between 2.3.4 and 2.3.5dev ----------------------------------- +- issue250 unicode/str mixes in parametrization names and values now works + - issue257, assertion-triggered compilation of source ending in a comment line doesn't blow up in python2.5 (fixed through py>=1.4.13.dev6) diff --git a/_pytest/python.py b/_pytest/python.py index f145ca5b8..a18b80bc1 100644 --- a/_pytest/python.py +++ b/_pytest/python.py @@ -732,7 +732,7 @@ def idmaker(argnames, argvalues): this_id = [] for nameindex, val in enumerate(valset): if not isinstance(val, (float, int, str)): - this_id.append(argnames[nameindex]+str(valindex)) + this_id.append(str(argnames[nameindex])+str(valindex)) else: this_id.append(str(val)) idlist.append("-".join(this_id)) diff --git a/testing/python/metafunc.py b/testing/python/metafunc.py index 1dc7c107a..b9d46994a 100644 --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -1,3 +1,4 @@ + import pytest, py, sys from _pytest import python as funcargs from _pytest.python import FixtureLookupError @@ -106,6 +107,7 @@ class TestMetafunc: assert metafunc._calls[2].id == "x1-a" assert metafunc._calls[3].id == "x1-b" + @pytest.mark.issue250 def test_idmaker_autoname(self): from _pytest.python import idmaker result = idmaker(("a", "b"), [("string", 1.0), @@ -115,6 +117,9 @@ class TestMetafunc: result = idmaker(("a", "b"), [(object(), 1.0), (object(), object())]) assert result == ["a0-1.0", "a1-b1"] + # unicode mixing, issue250 + result = idmaker((u"a", "b"), [({}, '\xc3\xb4')]) + assert result == ['a0-\xc3\xb4'] def test_addcall_and_parametrize(self): diff --git a/tox.ini b/tox.ini index 6a41a27af..509d2d394 100644 --- a/tox.ini +++ b/tox.ini @@ -50,6 +50,13 @@ changedir=. commands=py.test --doctest-modules _pytest deps= +[testenv:py32] +deps= + :pypi:nose + +[testenv:py33] +deps= + :pypi:nose [testenv:doc] basepython=python