Skip to content

Commit c447175

Browse files
authoredDec 5, 2023
fix: Use warning instead of warn in system tests to avoid DeprecationWarning (#821)
* fix: Use warning instead of warn in system tests to avoid DeprecationWarning * Removed ignore like from pytest.ini
1 parent 0ba8220 commit c447175

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed
 

‎pytest.ini

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ filterwarnings =
1717
ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:google.cloud.logging_v2.handlers.transports
1818
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:tests.unit.test__http
1919
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:tests.unit.test_entries
20-
# Remove once https://github.com/googleapis/python-logging/issues/820 is fixed
21-
ignore:.*warn.*is deprecated, use.*warning.*instead:DeprecationWarning
2220
# Remove once a version of grpcio newer than 1.59.3 is released to PyPI
2321
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:grpc._channel

‎tests/system/test_system.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def test_handlers_w_extras(self):
605605
"resource": Resource(type="cloudiot_device", labels={}),
606606
"labels": {"test-label": "manual"},
607607
}
608-
cloud_logger.warn(LOG_MESSAGE, extra=extra)
608+
cloud_logger.warning(LOG_MESSAGE, extra=extra)
609609

610610
entries = _list_entries(logger)
611611
self.assertEqual(len(entries), 1)
@@ -634,7 +634,7 @@ def test_handlers_w_json_fields(self):
634634
cloud_logger = logging.getLogger(LOGGER_NAME)
635635
cloud_logger.addHandler(handler)
636636
extra = {"json_fields": {"hello": "world", "two": 2}}
637-
cloud_logger.warn(LOG_MESSAGE, extra=extra)
637+
cloud_logger.warning(LOG_MESSAGE, extra=extra)
638638

639639
entries = _list_entries(logger)
640640
self.assertEqual(len(entries), 1)

0 commit comments

Comments
 (0)
Please sign in to comment.