Skip to content

Closes #19521: Clean up test suite output #19524

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

Merged
merged 8 commits into from
May 21, 2025
Next Next commit
Suppress extraneous logging in BackgroundTaskTestCase
  • Loading branch information
jeremystretch committed May 16, 2025
commit 26091cfa8756237d5627845e0c493f002000f8cf
7 changes: 5 additions & 2 deletions netbox/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from users.models import Token, User
from utilities.testing import APITestCase, APIViewTestCases, TestCase
from utilities.testing.utils import disable_logging
from ..models import *


Expand Down Expand Up @@ -189,7 +190,8 @@ def test_background_task_requeue(self):
# Enqueue & run a job that will fail
job = queue.enqueue(self.dummy_job_failing)
worker = get_worker('default')
worker.work(burst=True)
with disable_logging():
worker.work(burst=True)
self.assertTrue(job.is_failed)

# Re-enqueue the failed job and check that its status has been reset
Expand Down Expand Up @@ -231,7 +233,8 @@ def test_background_task_stop(self):
self.assertEqual(job.get_status(), JobStatus.STARTED)
response = self.client.post(reverse('core-api:rqtask-stop', args=[job.id]), **self.header)
self.assertEqual(response.status_code, 200)
worker.monitor_work_horse(job, queue) # Sets the job as Failed and removes from Started
with disable_logging():
worker.monitor_work_horse(job, queue) # Sets the job as Failed and removes from Started
started_job_registry = StartedJobRegistry(queue.name, connection=queue.connection)
self.assertEqual(len(started_job_registry), 0)

Expand Down