Merge pull request #1438 from Bachmann1234/issue-1437
Make a good faith effort to display a bytestring when one is provided…
This commit is contained in:
@@ -392,6 +392,20 @@ class TestGeneralUsage:
|
||||
monkeypatch.setitem(sys.modules, 'myplugin', mod)
|
||||
assert pytest.main(args=[str(tmpdir)], plugins=['myplugin']) == 0
|
||||
|
||||
def test_parameterized_with_bytes_regex(self, testdir):
|
||||
p = testdir.makepyfile("""
|
||||
import re
|
||||
import pytest
|
||||
@pytest.mark.parametrize('r', [re.compile(b'foo')])
|
||||
def test_stuff(r):
|
||||
pass
|
||||
"""
|
||||
)
|
||||
res = testdir.runpytest(p)
|
||||
res.stdout.fnmatch_lines([
|
||||
'*1 passed*'
|
||||
])
|
||||
|
||||
|
||||
class TestInvocationVariants:
|
||||
def test_earlyinit(self, testdir):
|
||||
|
||||
@@ -170,6 +170,11 @@ class TestMetafunc:
|
||||
result = idmaker((py.builtin._totext("a"), "b"), [({}, b'\xc3\xb4')])
|
||||
assert result == ['a0-\\xc3\\xb4']
|
||||
|
||||
def test_idmaker_with_bytes_regex(self):
|
||||
from _pytest.python import idmaker
|
||||
result = idmaker(("a"), [(re.compile(b'foo'), 1.0)])
|
||||
assert result == ["foo"]
|
||||
|
||||
def test_idmaker_native_strings(self):
|
||||
from _pytest.python import idmaker
|
||||
totext = py.builtin._totext
|
||||
|
||||
Reference in New Issue
Block a user