mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
Merge pull request #587 from Unrud/testscapturelogging
Capture log messages during tests
This commit is contained in:
commit
bc49542a62
2 changed files with 10 additions and 2 deletions
|
@ -19,15 +19,25 @@ Tests for Radicale.
|
|||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from io import BytesIO
|
||||
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
|
||||
|
||||
logger = logging.getLogger("radicale_test")
|
||||
if not logger.hasHandlers():
|
||||
handler = logging.StreamHandler(sys.stderr)
|
||||
handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
|
||||
logger.addHandler(handler)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
class BaseTest:
|
||||
"""Base class for tests."""
|
||||
logger = logger
|
||||
|
||||
def request(self, method, path, data=None, **args):
|
||||
"""Send a request."""
|
||||
self.application._status = None
|
||||
|
|
|
@ -20,7 +20,6 @@ Radicale tests with simple requests.
|
|||
"""
|
||||
|
||||
import base64
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import shutil
|
||||
|
@ -868,7 +867,6 @@ class BaseFileSystemTest(BaseTest):
|
|||
def setup(self):
|
||||
self.configuration = config.load()
|
||||
self.configuration.set("storage", "type", self.storage_type)
|
||||
self.logger = logging.getLogger("radicale_test")
|
||||
self.colpath = tempfile.mkdtemp()
|
||||
self.configuration.set("storage", "filesystem_folder", self.colpath)
|
||||
# Disable syncing to disk for better performance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue