Add a workaround for pytest-html surrogate issue.

See https://github.com/davehunt/pytest-html/issues/12
This commit is contained in:
Florian Bruhin 2015-08-11 21:11:28 +02:00
parent 6b6bceeb3a
commit 9c3c46f677

View File

@ -1148,10 +1148,12 @@ class TestFileAndUserStyleSheet:
with pytest.raises(configexc.ValidationError):
configtypes.File().validate('foobar')
UNICODE = object()
@pytest.mark.parametrize('configtype, value, raises', [
(configtypes.File(), 'foobar', True),
(configtypes.UserStyleSheet(), 'foobar', False),
(configtypes.UserStyleSheet(), '\ud800', True),
(configtypes.UserStyleSheet(), UNICODE, True),
])
def test_validate_rel_inexistent(self, os_mock, monkeypatch, configtype,
value, raises):
@ -1162,6 +1164,10 @@ class TestFileAndUserStyleSheet:
os_mock.path.isabs.return_value = False
os_mock.path.isfile.side_effect = os.path.isfile
if value is self.UNICODE:
# WORKAROUND for https://github.com/davehunt/pytest-html/issues/12
value = '\ud800'
if raises:
with pytest.raises(configexc.ValidationError):
configtype.validate(value)