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

Make tests fail on warnings; add some warnings to ignore list #1193

Merged
merged 6 commits into from
Aug 11, 2023
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
18 changes: 18 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[pytest]
asyncio_mode = auto
addopts =
-v
filterwarnings =
error
; botocore has this warning that is reported by them to be irrelevant
ignore:.*urllib3.contrib.pyopenssl.*:DeprecationWarning:botocore.*
; latest main of aioresponses does not have this problem, but current package uses deprecated pkg_resources API
ignore:.*pkg_resources.*:DeprecationWarning
; SQLAlchemy uses deprecated APIs internally
ignore:.*dbapi().*:DeprecationWarning
; aiogoogle inherits on top of AioHttpSession, which is not recommended by aiohttp
ignore:Inheritance class AiohttpSession from ClientSession is discouraged:DeprecationWarning
; aiogoogle inherits on top of RetryableAioHttpSession, which is not recommended by aiohttp
ignore:Inheritance class RetryableAiohttpSession from ClientSession is discouraged:DeprecationWarning
; pytest may generate its own warnings in some situations, such as improper usage or deprecated features.
ignore::pytest.PytestUnraisableExceptionWarning
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

17 changes: 11 additions & 6 deletions tests/sources/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,17 @@ async def test_slack_data_source_get_docs(slack_data_source, mock_responses):
channels_response = [{"id": "1", "name": "channel1", "is_member": True}]
messages_response = [{"text": "message1", "type": "message", "ts": 123456}]

slack_client = AsyncMock()
slack_client.list_users = AsyncIterator(users_response)
slack_client.list_channels = AsyncIterator(channels_response)
slack_client.list_messages = AsyncIterator(messages_response)
slack_client.close = AsyncMock()
slack_data_source.slack_client = slack_client
# A bit weird, but Slack connector actually inits client in its __init__
# So we need to close it before redefining
original_client = slack_data_source.slack_client
await original_client.close()

mock_client = AsyncMock()
mock_client.list_users = AsyncIterator(users_response)
mock_client.list_channels = AsyncIterator(channels_response)
mock_client.list_messages = AsyncIterator(messages_response)
mock_client.close = AsyncMock()
slack_data_source.slack_client = mock_client

docs = []
async for doc, _ in slack_data_source.get_docs():
Expand Down