summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-08 18:26:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2020-08-08 18:26:53 +0000
commit0be043545b0aa18aed1a585170b2ddce9cfdb968 (patch)
treed38233ecfcb80ab290c545a6c26f1f692abba809 /tests
parentAdding upstream version 3.1.0. (diff)
downloadcfgv-0be043545b0aa18aed1a585170b2ddce9cfdb968.tar.xz
cfgv-0be043545b0aa18aed1a585170b2ddce9cfdb968.zip
Adding upstream version 3.2.0.upstream/3.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/cfgv_test.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/cfgv_test.py b/tests/cfgv_test.py
index 1b143a6..7320e4c 100644
--- a/tests/cfgv_test.py
+++ b/tests/cfgv_test.py
@@ -532,6 +532,16 @@ def test_load_from_filename_file_does_not_exist():
assert excinfo.value.args[0].error_msg == 'does_not_exist does not exist'
+def test_load_from_filename_unicode_error(tmp_path):
+ f = tmp_path.joinpath('f')
+ f.write_bytes(b'\x98\xae\xfe')
+
+ with pytest.raises(Error) as excinfo:
+ load_from_filename(f, map_required, json.loads, Error)
+ expected = (f'File {f}', mock.ANY)
+ _assert_exception_trace(excinfo.value.args[0], expected)
+
+
def test_load_from_filename_fails_load_strategy(tmpdir):
f = tmpdir.join('foo.notjson')
f.write('totes not json')