mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Add isatty method to LazyWriter.
This commit is contained in:
parent
044732f7bc
commit
e58f8b59b7
@ -87,6 +87,9 @@ class LazyWriter(object):
|
||||
def flush(self):
|
||||
self.open().flush()
|
||||
|
||||
def isatty(self):
|
||||
return bool(self.fileobj and self.fileobj.isatty())
|
||||
|
||||
class SafeAtoms(dict):
|
||||
|
||||
def __init__(self, atoms):
|
||||
|
||||
13
tests/test_005-lazywriter-isatty.py
Normal file
13
tests/test_005-lazywriter-isatty.py
Normal file
@ -0,0 +1,13 @@
|
||||
import sys
|
||||
|
||||
from gunicorn.glogging import LazyWriter
|
||||
|
||||
|
||||
def test_lazywriter_isatty():
|
||||
orig = sys.stdout
|
||||
sys.stdout = LazyWriter('test.log')
|
||||
try:
|
||||
sys.stdout.isatty()
|
||||
except AttributeError:
|
||||
raise AssertionError("LazyWriter has no attribute 'isatty'")
|
||||
sys.stdout = orig
|
||||
Loading…
x
Reference in New Issue
Block a user