Skip to content

Commit

Permalink
Add test and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
berkerpeksag committed Oct 31, 2017
1 parent 2dd7321 commit 4448569
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ application specific configuration.
Loading the config from a Python module requires the ``python:``
prefix.

.. versionchanged:: 19.8
Pre-19.4 behavior of loading a config file without a ``python:``
prefix is now restored.

Server Socket
-------------

Expand Down
4 changes: 4 additions & 0 deletions gunicorn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,10 @@ class ConfigFile(Setting):
.. versionchanged:: 19.4
Loading the config from a Python module requires the ``python:``
prefix.
.. versionchanged:: 19.8
Pre-19.4 behavior of loading a config file without a ``python:``
prefix is now restored.
"""

class Bind(Setting):
Expand Down
14 changes: 14 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,20 @@ def test_load_config_module():
assert app.cfg.proc_name == "fooey"


@pytest.mark.parametrize("options", [
["-c", cfg_module()],
["-c", cfg_file()],
])
def test_load_fallback(options):
cmdline = ["prog_name"]
cmdline.extend(options)
with AltArgs(cmdline):
app = NoConfigApp()
assert app.cfg.bind == ["unix:/tmp/bar/baz"]
assert app.cfg.workers == 3
assert app.cfg.proc_name == "fooey"


def test_cli_overrides_config():
with AltArgs(["prog_name", "-c", cfg_file(), "-b", "blarney"]):
app = NoConfigApp()
Expand Down

0 comments on commit 4448569

Please sign in to comment.