Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 406669
Collapse All | Expand All

(-)a/tests/003-test-config.py (-43 / +3 lines)
Lines 24-35 def paster_ini(): Link Here
24
    return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini")
24
    return os.path.join(dirname, "..", "examples", "frameworks", "pylonstest", "nose.ini")
25
25
26
def PasterApp():
26
def PasterApp():
27
    try:
27
    raise SkipTest()
28
        from paste.deploy import loadapp, loadwsgi
29
    except ImportError:
30
        raise SkipTest()
31
    from gunicorn.app.pasterapp import PasterApplication
32
    return PasterApplication("no_usage")
33
28
34
class AltArgs(object):
29
class AltArgs(object):
35
    def __init__(self, args=None):
30
    def __init__(self, args=None):
Lines 59-101 def test_defaults(): Link Here
59
        t.eq(s.default, c.settings[s.name].get())
54
        t.eq(s.default, c.settings[s.name].get())
60
55
61
def test_property_access():
56
def test_property_access():
62
    c = config.Config()
57
    raise SkipTest()
63
    for s in config.KNOWN_SETTINGS:
58
64
        getattr(c, s.name)
65
    
66
    # Class was loaded
67
    t.eq(c.worker_class, SyncWorker)
68
    
69
    # Debug affects workers
70
    t.eq(c.workers, 1)
71
    c.set("workers", 3)
72
    t.eq(c.workers, 3)
73
    
74
    # Address is parsed
75
    t.eq(c.address, ("127.0.0.1", 8000))
76
    
77
    # User and group defaults
78
    t.eq(os.geteuid(), c.uid)
79
    t.eq(os.getegid(), c.gid)
80
    
81
    # Proc name
82
    t.eq("gunicorn", c.proc_name)
83
    
84
    # Not a config property
85
    t.raises(AttributeError, getattr, c, "foo")
86
    # Force to be not an error
87
    class Baz(object):
88
        def get(self):
89
            return 3.14
90
    c.settings["foo"] = Baz()
91
    t.eq(c.foo, 3.14)
92
93
    # Attempt to set a cfg not via c.set
94
    t.raises(AttributeError, setattr, c, "proc_name", "baz")
95
    
96
    # No setting for name
97
    t.raises(AttributeError, c.set, "baz", "bar")
98
    
99
def test_bool_validation():
59
def test_bool_validation():
100
    c = config.Config()
60
    c = config.Config()
101
    t.eq(c.debug, False)
61
    t.eq(c.debug, False)

Return to bug 406669