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
Prev Previous commit
Next Next commit
Suppress deprecation warnings in ScriptTest
  • Loading branch information
jeremystretch committed May 16, 2025
commit 3d6e6bc2833454c1e0eb0aa09f767f1495802415
8 changes: 6 additions & 2 deletions netbox/extras/tests/test_scripts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import tempfile
from datetime import date, datetime, timezone

Expand All @@ -7,6 +8,7 @@

from dcim.models import DeviceRole
from extras.scripts import *
from utilities.testing import disable_logging

CHOICES = (
('ff0000', 'Red'),
Expand Down Expand Up @@ -39,7 +41,8 @@ def test_load_yaml(self):
datafile.write(bytes(YAML_DATA, 'UTF-8'))
datafile.seek(0)

data = Script().load_yaml(datafile.name)
with disable_logging(level=logging.WARNING):
data = Script().load_yaml(datafile.name)
self.assertEqual(data, {
'Foo': 123,
'Bar': 456,
Expand All @@ -51,7 +54,8 @@ def test_load_json(self):
datafile.write(bytes(JSON_DATA, 'UTF-8'))
datafile.seek(0)

data = Script().load_json(datafile.name)
with disable_logging(level=logging.WARNING):
data = Script().load_json(datafile.name)
self.assertEqual(data, {
'Foo': 123,
'Bar': 456,
Expand Down