From 9c3c46f6777e97baf909c07bd606a493c3ed3f2f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Aug 2015 21:11:28 +0200 Subject: [PATCH] Add a workaround for pytest-html surrogate issue. See https://github.com/davehunt/pytest-html/issues/12 --- tests/config/test_configtypes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/config/test_configtypes.py b/tests/config/test_configtypes.py index 23fd8833d..c97b439c9 100644 --- a/tests/config/test_configtypes.py +++ b/tests/config/test_configtypes.py @@ -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)