| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  | import json | 
					
						
							| 
									
										
										
										
											2016-12-26 10:50:47 +08:00
										 |  |  | import os | 
					
						
							| 
									
										
										
										
											2019-06-01 23:35:03 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | import pytest | 
					
						
							| 
									
										
										
										
											2016-12-26 10:50:47 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:21:26 +08:00
										 |  |  | import flask | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-01 03:56:15 +08:00
										 |  |  | # config keys used for the TestConfig | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  | TEST_KEY = "foo" | 
					
						
							|  |  |  | SECRET_KEY = "config" | 
					
						
							| 
									
										
										
										
											2011-08-26 18:21:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | def common_object_test(app): | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert app.secret_key == "config" | 
					
						
							|  |  |  |     assert app.config["TEST_KEY"] == "foo" | 
					
						
							|  |  |  |     assert "TestConfig" not in app.config | 
					
						
							| 
									
										
										
										
											2011-08-26 18:21:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  | def test_config_from_pyfile(): | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2020-04-05 02:39:03 +08:00
										 |  |  |     app.config.from_pyfile(f"{__file__.rsplit('.', 1)[0]}.py") | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     common_object_test(app) | 
					
						
							| 
									
										
										
										
											2011-08-26 18:21:26 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | def test_config_from_object(): | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     app.config.from_object(__name__) | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							| 
									
										
										
										
											2013-08-08 06:03:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-07-27 17:19:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-22 21:40:49 +08:00
										 |  |  | def test_config_from_file_json(): | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     current_dir = os.path.dirname(os.path.abspath(__file__)) | 
					
						
							| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  |     app.config.from_file(os.path.join(current_dir, "static", "config.json"), json.load) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     common_object_test(app) | 
					
						
							| 
									
										
										
										
											2014-07-27 17:19:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-22 21:40:49 +08:00
										 |  |  | def test_config_from_file_toml(): | 
					
						
							|  |  |  |     tomllib = pytest.importorskip("tomllib", reason="tomllib added in 3.11") | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     current_dir = os.path.dirname(os.path.abspath(__file__)) | 
					
						
							|  |  |  |     app.config.from_file( | 
					
						
							|  |  |  |         os.path.join(current_dir, "static", "config.toml"), tomllib.load, text=False | 
					
						
							|  |  |  |     ) | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-26 02:00:32 +08:00
										 |  |  | def test_from_prefixed_env(monkeypatch): | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_STRING", "value") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_BOOL", "true") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_INT", "1") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_FLOAT", "1.2") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_LIST", "[1, 2]") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_DICT", '{"k": "v"}') | 
					
						
							|  |  |  |     monkeypatch.setenv("NOT_FLASK_OTHER", "other") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-09 05:40:48 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     app.config.from_prefixed_env() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-26 02:00:32 +08:00
										 |  |  |     assert app.config["STRING"] == "value" | 
					
						
							|  |  |  |     assert app.config["BOOL"] is True | 
					
						
							|  |  |  |     assert app.config["INT"] == 1 | 
					
						
							|  |  |  |     assert app.config["FLOAT"] == 1.2 | 
					
						
							|  |  |  |     assert app.config["LIST"] == [1, 2] | 
					
						
							|  |  |  |     assert app.config["DICT"] == {"k": "v"} | 
					
						
							|  |  |  |     assert "OTHER" not in app.config | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_from_prefixed_env_custom_prefix(monkeypatch): | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_A", "a") | 
					
						
							|  |  |  |     monkeypatch.setenv("NOT_FLASK_A", "b") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     app.config.from_prefixed_env("NOT_FLASK") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     assert app.config["A"] == "b" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_from_prefixed_env_nested(monkeypatch): | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_EXIST__ok", "other") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_EXIST__inner__ik", "2") | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_EXIST__new__more", '{"k": false}') | 
					
						
							|  |  |  |     monkeypatch.setenv("FLASK_NEW__K", "v") | 
					
						
							| 
									
										
										
										
											2022-03-09 05:40:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2022-03-26 02:00:32 +08:00
										 |  |  |     app.config["EXIST"] = {"ok": "value", "flag": True, "inner": {"ik": 1}} | 
					
						
							|  |  |  |     app.config.from_prefixed_env() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-26 03:05:07 +08:00
										 |  |  |     if os.name != "nt": | 
					
						
							|  |  |  |         assert app.config["EXIST"] == { | 
					
						
							|  |  |  |             "ok": "other", | 
					
						
							|  |  |  |             "flag": True, | 
					
						
							|  |  |  |             "inner": {"ik": 2}, | 
					
						
							|  |  |  |             "new": {"more": {"k": False}}, | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     else: | 
					
						
							|  |  |  |         # Windows env var keys are always uppercase. | 
					
						
							|  |  |  |         assert app.config["EXIST"] == { | 
					
						
							|  |  |  |             "ok": "value", | 
					
						
							|  |  |  |             "OK": "other", | 
					
						
							|  |  |  |             "flag": True, | 
					
						
							|  |  |  |             "inner": {"ik": 1}, | 
					
						
							|  |  |  |             "INNER": {"IK": 2}, | 
					
						
							|  |  |  |             "NEW": {"MORE": {"k": False}}, | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-26 02:00:32 +08:00
										 |  |  |     assert app.config["NEW"] == {"K": "v"} | 
					
						
							| 
									
										
										
										
											2022-03-09 05:40:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | def test_config_from_mapping(): | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     app.config.from_mapping({"SECRET_KEY": "config", "TEST_KEY": "foo"}) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     app.config.from_mapping([("SECRET_KEY", "config"), ("TEST_KEY", "foo")]) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     app.config.from_mapping(SECRET_KEY="config", TEST_KEY="foo") | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-31 23:51:39 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     app.config.from_mapping(SECRET_KEY="config", TEST_KEY="foo", skip_key="skip") | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     with pytest.raises(TypeError): | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |         app.config.from_mapping({}, {}) | 
					
						
							| 
									
										
										
										
											2014-07-27 17:19:52 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 18:21:26 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | def test_config_from_class(): | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  |     class Base: | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |         TEST_KEY = "foo" | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     class Test(Base): | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |         SECRET_KEY = "config" | 
					
						
							| 
									
										
										
										
											2017-06-28 22:58:06 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							|  |  |  |     app.config.from_object(Test) | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  | def test_config_from_envvar(monkeypatch): | 
					
						
							|  |  |  |     monkeypatch.setattr("os.environ", {}) | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2022-04-29 00:32:31 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  |     with pytest.raises(RuntimeError) as e: | 
					
						
							|  |  |  |         app.config.from_envvar("FOO_SETTINGS") | 
					
						
							| 
									
										
										
										
											2022-04-29 00:32:31 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     assert "'FOO_SETTINGS' is not set" in str(e.value) | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  |     assert not app.config.from_envvar("FOO_SETTINGS", silent=True) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     monkeypatch.setattr( | 
					
						
							| 
									
										
										
										
											2020-04-05 02:39:03 +08:00
										 |  |  |         "os.environ", {"FOO_SETTINGS": f"{__file__.rsplit('.', 1)[0]}.py"} | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  |     assert app.config.from_envvar("FOO_SETTINGS") | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_config_from_envvar_missing(monkeypatch): | 
					
						
							|  |  |  |     monkeypatch.setattr("os.environ", {"FOO_SETTINGS": "missing.cfg"}) | 
					
						
							| 
									
										
										
										
											2022-04-29 00:32:31 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  |     with pytest.raises(IOError) as e: | 
					
						
							|  |  |  |         app.config.from_envvar("FOO_SETTINGS") | 
					
						
							|  |  |  |     msg = str(e.value) | 
					
						
							|  |  |  |     assert msg.startswith( | 
					
						
							| 
									
										
										
										
											2019-06-02 00:22:20 +08:00
										 |  |  |         "[Errno 2] Unable to load configuration file (No such file or directory):" | 
					
						
							| 
									
										
										
										
											2019-06-01 02:53:26 +08:00
										 |  |  |     ) | 
					
						
							|  |  |  |     assert msg.endswith("missing.cfg'") | 
					
						
							|  |  |  |     assert not app.config.from_envvar("FOO_SETTINGS", silent=True) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_config_missing(): | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     with pytest.raises(IOError) as e: | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |         app.config.from_pyfile("missing.cfg") | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     msg = str(e.value) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert msg.startswith( | 
					
						
							| 
									
										
										
										
											2019-06-02 00:22:20 +08:00
										 |  |  |         "[Errno 2] Unable to load configuration file (No such file or directory):" | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     ) | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     assert msg.endswith("missing.cfg'") | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert not app.config.from_pyfile("missing.cfg", silent=True) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  | def test_config_missing_file(): | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     with pytest.raises(IOError) as e: | 
					
						
							| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  |         app.config.from_file("missing.json", load=json.load) | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     msg = str(e.value) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert msg.startswith( | 
					
						
							| 
									
										
										
										
											2019-06-02 00:22:20 +08:00
										 |  |  |         "[Errno 2] Unable to load configuration file (No such file or directory):" | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     ) | 
					
						
							| 
									
										
										
										
											2016-03-04 19:30:40 +08:00
										 |  |  |     assert msg.endswith("missing.json'") | 
					
						
							| 
									
										
										
										
											2019-10-11 18:52:29 +08:00
										 |  |  |     assert not app.config.from_file("missing.json", load=json.load, silent=True) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_custom_config_class(): | 
					
						
							|  |  |  |     class Config(flask.Config): | 
					
						
							|  |  |  |         pass | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     class Flask(flask.Flask): | 
					
						
							|  |  |  |         config_class = Config | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     app = Flask(__name__) | 
					
						
							|  |  |  |     assert isinstance(app.config, Config) | 
					
						
							|  |  |  |     app.config.from_object(__name__) | 
					
						
							|  |  |  |     common_object_test(app) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_session_lifetime(): | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     app.config["PERMANENT_SESSION_LIFETIME"] = 42 | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     assert app.permanent_session_lifetime.seconds == 42 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_get_namespace(): | 
					
						
							|  |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     app.config["FOO_OPTION_1"] = "foo option 1" | 
					
						
							|  |  |  |     app.config["FOO_OPTION_2"] = "foo option 2" | 
					
						
							|  |  |  |     app.config["BAR_STUFF_1"] = "bar stuff 1" | 
					
						
							|  |  |  |     app.config["BAR_STUFF_2"] = "bar stuff 2" | 
					
						
							|  |  |  |     foo_options = app.config.get_namespace("FOO_") | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     assert 2 == len(foo_options) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert "foo option 1" == foo_options["option_1"] | 
					
						
							|  |  |  |     assert "foo option 2" == foo_options["option_2"] | 
					
						
							|  |  |  |     bar_options = app.config.get_namespace("BAR_", lowercase=False) | 
					
						
							| 
									
										
										
										
											2014-09-04 21:43:18 +08:00
										 |  |  |     assert 2 == len(bar_options) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert "bar stuff 1" == bar_options["STUFF_1"] | 
					
						
							|  |  |  |     assert "bar stuff 2" == bar_options["STUFF_2"] | 
					
						
							|  |  |  |     foo_options = app.config.get_namespace("FOO_", trim_namespace=False) | 
					
						
							| 
									
										
										
										
											2014-10-24 17:11:07 +08:00
										 |  |  |     assert 2 == len(foo_options) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert "foo option 1" == foo_options["foo_option_1"] | 
					
						
							|  |  |  |     assert "foo option 2" == foo_options["foo_option_2"] | 
					
						
							|  |  |  |     bar_options = app.config.get_namespace( | 
					
						
							|  |  |  |         "BAR_", lowercase=False, trim_namespace=False | 
					
						
							|  |  |  |     ) | 
					
						
							| 
									
										
										
										
											2014-10-24 17:11:07 +08:00
										 |  |  |     assert 2 == len(bar_options) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     assert "bar stuff 1" == bar_options["BAR_STUFF_1"] | 
					
						
							|  |  |  |     assert "bar stuff 2" == bar_options["BAR_STUFF_2"] | 
					
						
							| 
									
										
										
										
											2016-12-26 10:50:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  | @pytest.mark.parametrize("encoding", ["utf-8", "iso-8859-15", "latin-1"]) | 
					
						
							| 
									
										
										
										
											2023-05-03 01:38:27 +08:00
										 |  |  | def test_from_pyfile_weird_encoding(tmp_path, encoding): | 
					
						
							|  |  |  |     f = tmp_path / "my_config.py" | 
					
						
							|  |  |  |     f.write_text(f'# -*- coding: {encoding} -*-\nTEST_VALUE = "föö"\n', encoding) | 
					
						
							| 
									
										
										
										
											2016-12-26 10:50:47 +08:00
										 |  |  |     app = flask.Flask(__name__) | 
					
						
							| 
									
										
										
										
											2023-05-03 01:38:27 +08:00
										 |  |  |     app.config.from_pyfile(os.fspath(f)) | 
					
						
							| 
									
										
										
										
											2019-05-07 03:39:41 +08:00
										 |  |  |     value = app.config["TEST_VALUE"] | 
					
						
							| 
									
										
										
										
											2020-04-05 00:43:06 +08:00
										 |  |  |     assert value == "föö" |