Commit b785e104 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Pass a file-like object for the log, rather than the filename, thus allowing

StringIO for example.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@45925 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e31901a3
...@@ -151,7 +151,7 @@ class Browser(ExtendedTestBrowser): ...@@ -151,7 +151,7 @@ class Browser(ExtendedTestBrowser):
erp5_site_id, erp5_site_id,
username, username,
password, password,
log_filename=None, log_file=None,
is_debug=False, is_debug=False,
is_legacy_listbox=False): is_legacy_listbox=False):
""" """
...@@ -166,8 +166,8 @@ class Browser(ExtendedTestBrowser): ...@@ -166,8 +166,8 @@ class Browser(ExtendedTestBrowser):
@param username: Username to be used to log into ERP5 @param username: Username to be used to log into ERP5
@type username: str @type username: str
@param password: Password to be used to log into ERP5 @param password: Password to be used to log into ERP5
@param log_filename: Log filename (stderr if none given) @param log_file: Log file object (stderr if none given)
@type log_filename: str @type log_file: file
@param is_debug: Enable or disable debugging (disable by default) @param is_debug: Enable or disable debugging (disable by default)
@type is_debug: bool @type is_debug: bool
@param is_legacy_listbox: Use legacy listbox @param is_legacy_listbox: Use legacy listbox
...@@ -189,10 +189,8 @@ class Browser(ExtendedTestBrowser): ...@@ -189,10 +189,8 @@ class Browser(ExtendedTestBrowser):
# Only display WARNING message if debugging is not enabled # Only display WARNING message if debugging is not enabled
logging_level = is_debug and logging.DEBUG or logging.WARNING logging_level = is_debug and logging.DEBUG or logging.WARNING
if log_filename: stream = log_file and log_file or sys.stderr
logging.basicConfig(filename=log_filename, level=logging_level) logging.basicConfig(stream=stream, level=logging_level)
else:
logging.basicConfig(stream=sys.stderr, level=logging_level)
self._logger = logging.getLogger('erp5.utils.test_browser') self._logger = logging.getLogger('erp5.utils.test_browser')
self._is_legacy_listbox = is_legacy_listbox self._is_legacy_listbox = is_legacy_listbox
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment