Skip to content
Snippets Groups Projects
Commit a52f1271 authored by payno's avatar payno
Browse files

[app][test] avoid sending lo messages to graylog during test

parent 73ab036d
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,7 @@ import sys
import argparse
import logging
import unittest
import os
class StreamHandlerUnittestReady(logging.StreamHandler):
......@@ -100,6 +101,9 @@ def main(argv):
"including debug messages and test help strings.")
parser.add_argument("--qt-binding", dest="qt_binding", default=None,
help="Force using a Qt binding: 'PyQt5' or 'PySide2'")
parser.add_argument("--web", dest="web_log", default=False,
help="Force unit test to export his log to graylog'",
action="store_true")
utils.test_options.add_parser_argument(parser)
options = parser.parse_args(argv[1:])
......@@ -134,6 +138,9 @@ def main(argv):
else:
raise ValueError("Qt binding '%s' is unknown" % options.qt_binding)
previous_web_log_value = os.environ.get("ORANGE_WEB_LOG")
os.environ["ORANGE_WEB_LOG"] = str(options.web_log)
# Configure test options
utils.test_options.configure(options)
......@@ -154,6 +161,12 @@ def main(argv):
test_suite.addTest(orangecontrib.tomwer.test.suite())
result = runner.run(test_suite)
# reset the if ORANGE_WEB_LOG value
if previous_web_log_value is None:
del os.environ["ORANGE_WEB_LOG"]
else:
os.environ["ORANGE_WEB_LOG"] = previous_web_log_value
if result.wasSuccessful():
exit_status = 0
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment