| 1 |
holger krekel 1677d28 issue250 unicode/str mixes in parametrization names and values now works; Wed Feb 13
|
| 2 |
diff -ur pytest-2.3.4.orig/_pytest/python.py pytest-2.3.4/_pytest/python.py
|
| 3 |
--- _pytest/python.py 2012-11-20 14:07:28.000000000 +0800
|
| 4 |
+++ _pytest/python.py 2013-02-14 09:55:16.369853793 +0800
|
| 5 |
@@ -730,7 +730,7 @@
|
| 6 |
this_id = []
|
| 7 |
for nameindex, val in enumerate(valset):
|
| 8 |
if not isinstance(val, (float, int, str)):
|
| 9 |
- this_id.append(argnames[nameindex]+str(valindex))
|
| 10 |
+ this_id.append(str(argnames[nameindex])+str(valindex))
|
| 11 |
else:
|
| 12 |
this_id.append(str(val))
|
| 13 |
idlist.append("-".join(this_id))
|
| 14 |
diff -ur pytest-2.3.4.orig/testing/python/metafunc.py pytest-2.3.4/testing/python/metafunc.py
|
| 15 |
--- testing/python/metafunc.py 2012-11-20 14:07:28.000000000 +0800
|
| 16 |
+++ testing/python/metafunc.py 2013-02-14 10:01:43.442834535 +0800
|
| 17 |
@@ -106,6 +106,7 @@
|
| 18 |
assert metafunc._calls[2].id == "x1-a"
|
| 19 |
assert metafunc._calls[3].id == "x1-b"
|
| 20 |
|
| 21 |
+ @pytest.mark.issue250
|
| 22 |
def test_idmaker_autoname(self):
|
| 23 |
from _pytest.python import idmaker
|
| 24 |
result = idmaker(("a", "b"), [("string", 1.0),
|
| 25 |
@@ -115,6 +116,9 @@
|
| 26 |
result = idmaker(("a", "b"), [(object(), 1.0),
|
| 27 |
(object(), object())])
|
| 28 |
assert result == ["a0-1.0", "a1-b1"]
|
| 29 |
+ # unicode mixing, issue250
|
| 30 |
+ result = idmaker((py.builtin._totext("a"), "b"), [({}, '\xc3\xb4')])
|
| 31 |
+ assert result == ['a0-\xc3\xb4']
|
| 32 |
|
| 33 |
|
| 34 |
def test_addcall_and_parametrize(self):
|