From bfa3ae3d3bb158fa022c88a63561d60994c3e1df Mon Sep 17 00:00:00 2001 From: David Robertson Date: Tue, 5 Jul 2022 19:42:33 +0100 Subject: Print errors in test for confidence --- tests/config/test_oidc2.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/config/test_oidc2.py b/tests/config/test_oidc2.py index 3bff60214c..e5a9da68a7 100644 --- a/tests/config/test_oidc2.py +++ b/tests/config/test_oidc2.py @@ -1,3 +1,4 @@ +from contextlib import contextmanager from copy import deepcopy from typing import Any, Dict from unittest import TestCase @@ -54,6 +55,15 @@ class PydanticOIDCTestCase(TestCase): def setUp(self) -> None: self.config = deepcopy(SAMPLE_CONFIG) + @contextmanager + def assertRaises(self, *args, **kwargs): + """To demonstrate the example error messages generated by Pydantic, uncomment + this method.""" + with super().assertRaises(*args, **kwargs) as result: + yield result + print() + print(result.exception) + def test_example_config(self): # Check that parsing the sample config doesn't raise an error. OIDCProviderModel.parse_obj(self.config) -- cgit 1.4.1