mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Issue #3079, add unit test
This commit is contained in:
parent
ca2ce2c76b
commit
08364f0365
@ -13,6 +13,7 @@ from gunicorn import config
|
||||
from gunicorn.app.base import Application
|
||||
from gunicorn.app.wsgiapp import WSGIApplication
|
||||
from gunicorn.errors import ConfigError
|
||||
from gunicorn.util import load_class
|
||||
from gunicorn.workers.sync import SyncWorker
|
||||
from gunicorn import glogging
|
||||
from gunicorn.instrument import statsd
|
||||
@ -55,6 +56,10 @@ class NoConfigApp(Application):
|
||||
pass
|
||||
|
||||
|
||||
class CustomWorker(SyncWorker):
|
||||
pass
|
||||
|
||||
|
||||
class WSGIApp(WSGIApplication):
|
||||
def __init__(self):
|
||||
super().__init__("no_usage", prog="gunicorn_test")
|
||||
@ -63,6 +68,18 @@ class WSGIApp(WSGIApplication):
|
||||
pass
|
||||
|
||||
|
||||
def test_worker_class():
|
||||
|
||||
c = config.Config()
|
||||
c.set("worker_class", CustomWorker)
|
||||
assert c.worker_class == CustomWorker
|
||||
|
||||
try:
|
||||
assert isinstance(load_class(c.worker_class), object)
|
||||
except AttributeError:
|
||||
pytest.fail("'load_class doesn't support type class argument'")
|
||||
|
||||
|
||||
def test_defaults():
|
||||
c = config.Config()
|
||||
for s in config.KNOWN_SETTINGS:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user