Skip to content

Commit

Permalink
fix: Use warning instead of warn in system tests to avoid Deprecation…
Browse files Browse the repository at this point in the history
…Warning (#821)

* fix: Use warning instead of warn in system tests to avoid
DeprecationWarning

* Removed ignore like from pytest.ini
  • Loading branch information
gkevinzheng committed Dec 5, 2023
1 parent 0ba8220 commit c447175
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions pytest.ini
Expand Up @@ -17,7 +17,5 @@ filterwarnings =
ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:google.cloud.logging_v2.handlers.transports
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:tests.unit.test__http
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:tests.unit.test_entries
# Remove once https://github.com/googleapis/python-logging/issues/820 is fixed
ignore:.*warn.*is deprecated, use.*warning.*instead:DeprecationWarning
# Remove once a version of grpcio newer than 1.59.3 is released to PyPI
ignore:datetime.datetime.utcnow\(\) is deprecated:DeprecationWarning:grpc._channel
4 changes: 2 additions & 2 deletions tests/system/test_system.py
Expand Up @@ -605,7 +605,7 @@ def test_handlers_w_extras(self):
"resource": Resource(type="cloudiot_device", labels={}),
"labels": {"test-label": "manual"},
}
cloud_logger.warn(LOG_MESSAGE, extra=extra)
cloud_logger.warning(LOG_MESSAGE, extra=extra)

entries = _list_entries(logger)
self.assertEqual(len(entries), 1)
Expand Down Expand Up @@ -634,7 +634,7 @@ def test_handlers_w_json_fields(self):
cloud_logger = logging.getLogger(LOGGER_NAME)
cloud_logger.addHandler(handler)
extra = {"json_fields": {"hello": "world", "two": 2}}
cloud_logger.warn(LOG_MESSAGE, extra=extra)
cloud_logger.warning(LOG_MESSAGE, extra=extra)

entries = _list_entries(logger)
self.assertEqual(len(entries), 1)
Expand Down

0 comments on commit c447175

Please sign in to comment.