diff options
author | Bruno Wagner <bwagner@riseup.net> | 2016-10-19 16:56:43 -0200 |
---|---|---|
committer | Bruno Wagner <bwagner@riseup.net> | 2016-10-19 16:56:43 -0200 |
commit | 425d6a54e13be2cdcd18f1b21a4ff70ae5d43ff0 (patch) | |
tree | 6705d319deaaf9aee234e82c7e0f6815926f17ba /service/test | |
parent | f47533fed69c0ede45285a236bb85efa2938f134 (diff) |
Adapted logging in the UA to use twisted.logger
Diffstat (limited to 'service/test')
5 files changed, 15 insertions, 21 deletions
diff --git a/service/test/functional/features/environment.py b/service/test/functional/features/environment.py index 41f2c8c7..77efc499 100644 --- a/service/test/functional/features/environment.py +++ b/service/test/functional/features/environment.py @@ -13,24 +13,32 @@ # # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. -import logging import uuid +import os +from selenium import webdriver from crochet import setup, wait_for -from leap.common.events.server import ensure_server + from twisted.internet import defer +from twisted.logger import globalLogBeginner, textFileLogObserver, Logger -from pixelated.application import UserAgentMode -from pixelated.config.site import PixelatedSite from test.support.integration import AppTestClient -from selenium import webdriver +from steps.common import * +from leap.common.events.server import ensure_server + +from pixelated.application import UserAgentMode +from pixelated.config.site import PixelatedSite from pixelated.resources.features_resource import FeaturesResource -from steps.common import * -import os setup() +observers = [textFileLogObserver(open(os.devnull, 'w'))] + +globalLogBeginner.beginLoggingTo(observers) + +Logger('twisted') + @wait_for(timeout=5.0) def start_app_test_client(client, mode): @@ -39,7 +47,6 @@ def start_app_test_client(client, mode): def before_all(context): ensure_server() - logging.disable('INFO') PixelatedSite.disable_csp_requests() client = AppTestClient() start_app_test_client(client, UserAgentMode(is_single_user=True)) diff --git a/service/test/perf/contacts/test_Contacts.py b/service/test/perf/contacts/test_Contacts.py index 967e9eb1..ade97591 100644 --- a/service/test/perf/contacts/test_Contacts.py +++ b/service/test/perf/contacts/test_Contacts.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. import unittest -import logging from funkload.FunkLoadTestCase import FunkLoadTestCase from test.support.integration import AppTestClient @@ -33,7 +32,6 @@ def start_app_test_client(client): class Contacts(FunkLoadTestCase): def setUpBench(self): - logging.disable('INFO') client = AppTestClient() start_app_test_client(client) client.listenTCP() diff --git a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py index 2aaa969c..f0e1e8c9 100644 --- a/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py +++ b/service/test/unit/adapter/mailstore/maintenance/test_soledad_maintenance.py @@ -20,9 +20,6 @@ from twisted.trial import unittest from mockito import mock, when, verify, never from pixelated.adapter.mailstore.maintenance import SoledadMaintenance from leap.bitmask.keymanager.openpgp import OpenPGPKey -import logging - -logging.getLogger('pixelated.adapter.mailstore.maintenance').addHandler(logging.NullHandler()) SOME_EMAIL_ADDRESS = 'foo@example.tld' diff --git a/service/test/unit/resources/test_attachments_resource.py b/service/test/unit/resources/test_attachments_resource.py index 0424c481..06ae765f 100644 --- a/service/test/unit/resources/test_attachments_resource.py +++ b/service/test/unit/resources/test_attachments_resource.py @@ -1,6 +1,5 @@ import json import unittest -import logging from mock import patch, MagicMock from mockito import mock, when, verify, any as ANY @@ -11,9 +10,6 @@ from pixelated.application import UserAgentMode from pixelated.resources.attachments_resource import AttachmentsResource from test.unit.resources import DummySite -logging.basicConfig(level=logging.CRITICAL) -logging.getLogger('pixelated.resources.attachments_resource').addHandler(logging.NullHandler()) - class AttachmentsResourceTest(unittest.TestCase): diff --git a/service/test/unit/resources/test_tags_resource.py b/service/test/unit/resources/test_tags_resource.py index 684e95f2..a05da7a7 100644 --- a/service/test/unit/resources/test_tags_resource.py +++ b/service/test/unit/resources/test_tags_resource.py @@ -1,13 +1,9 @@ -import logging - from mock import MagicMock from twisted.trial import unittest from twisted.web.test.requesthelper import DummyRequest from pixelated.resources.tags_resource import TagsResource from test.unit.resources import DummySite -logging.getLogger('pixelated.resources').addHandler(logging.NullHandler()) - class TestTagsResource(unittest.TestCase): def setUp(self): |