Repository: radiasoft/pykern

Issue:
pkconfig.in_dev_mode 'NoneType' object has no attribute 'dev_mode

Discussion:

Patch:
diff --git a/pykern/pkconfig.py b/pykern/pkconfig.py
index 994d561..bc60c33 100644
--- a/pykern/pkconfig.py
+++ b/pykern/pkconfig.py
@@ -286,6 +286,8 @@ def in_dev_mode():
         bool: value of `pykern.pykern.cfg.dev_mode`
 
     """
+    if not cfg:
+        _coalesce_values()
     return cfg.dev_mode
 
 


Test patch:
diff --git a/tests/pkconfig8_test.py b/tests/pkconfig8_test.py
new file mode 100644
index 0000000..a63742e
--- /dev/null
+++ b/tests/pkconfig8_test.py
@@ -0,0 +1,14 @@
+# -*- coding: utf-8 -*-
+"""test pkconfig.in_dev_mode()
+
+:copyright: Copyright (c) 2023 RadiaSoft LLC.  All Rights Reserved.
+:license: http://www.apache.org/licenses/LICENSE-2.0.html
+"""
+import pytest
+
+
+def test_in_dev_mode():
+    """Validate channel_in()"""
+    from pykern import pkconfig
+
+    assert pkconfig.in_dev_mode(), "should be in dev mode"