Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Avoided noisy error logging during tests #118 #175

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions openwisp_firmware_upgrader/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from django.core.exceptions import ValidationError
from django.test import TestCase, TransactionTestCase

from openwisp_utils.tests import capture_any_output

from .. import settings as app_settings
from ..hardware import FIRMWARE_IMAGE_MAP, REVERSE_FIRMWARE_IMAGE_MAP
from ..swapper import load_model
Expand Down Expand Up @@ -251,6 +253,7 @@ def test_permissions(self):
codename = '{}_{}'.format(action, model_name)
self.assertIn(codename, admin_permissions)

@capture_any_output()
def test_create_for_device_validation_error(self):
device_fw = self._create_device_firmware()
device_fw.image.build.os = device_fw.device.os
Expand Down
2 changes: 2 additions & 0 deletions openwisp_firmware_upgrader/tests/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from openwisp_controller.tests.utils import SeleniumTestMixin
from openwisp_firmware_upgrader.hardware import REVERSE_FIRMWARE_IMAGE_MAP
from openwisp_firmware_upgrader.tests.base import TestUpgraderMixin
from openwisp_utils.tests import capture_any_output

from ..swapper import load_model

Expand Down Expand Up @@ -73,6 +74,7 @@ def tearDown(self):
EC.visibility_of_element_located((By.XPATH, '//*[@id="site-name"]'))
)

@capture_any_output()
def test_restoring_deleted_device(self):
org = self._get_org()
category = self._get_category(organization=org)
Expand Down
4 changes: 4 additions & 0 deletions openwisp_firmware_upgrader/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from celery.exceptions import SoftTimeLimitExceeded
from django.test import TransactionTestCase

from openwisp_utils.tests import capture_any_output

from .. import tasks
from ..swapper import load_model
from .base import TestUpgraderMixin
Expand All @@ -21,6 +23,7 @@ class TestTasks(TestUpgraderMixin, TransactionTestCase):
'openwisp_firmware_upgrader.base.models.AbstractUpgradeOperation.upgrade',
side_effect=SoftTimeLimitExceeded(),
)
@capture_any_output()
def test_upgrade_firmware_timeout(self, *args):
device_fw = self._create_device_firmware(upgrade=True)
self.assertEqual(UpgradeOperation.objects.count(), 1)
Expand All @@ -34,6 +37,7 @@ def test_upgrade_firmware_timeout(self, *args):
'openwisp_firmware_upgrader.base.models.AbstractDeviceFirmware.create_upgrade_operation',
side_effect=SoftTimeLimitExceeded(),
)
@capture_any_output()
def test_batch_upgrade_timeout(self, *args):
env = self._create_upgrade_env()
batch = BatchUpgradeOperation.objects.create(build=env['build2'])
Expand Down