diff --git a/test/unit/test_base_context.py b/test/unit/test_base_context.py new file mode 100644 index 00000000000..462323de5d7 --- /dev/null +++ b/test/unit/test_base_context.py @@ -0,0 +1,12 @@ +from dbt.context.base import BaseContext +from jinja2.runtime import Undefined + + +class TestBaseContext: + def test_log_jinja_undefined(self): + # regression test for CT-2259 + try: + os.environ["DBT_ENV_SECRET_LOG_TEST"] = "cats_are_cool" + BaseContext.log(msg=Undefined(), info=True) + except Exception as e: + assert False, f"Logging an jinja2.Undefined object raises an exception: {e}"